<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">System.Console.Haskeline.Command.History</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-2"></span><span>
</span><span id="line-3"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="System.Console.Haskeline.LineState.html"><span class="hs-identifier">System.Console.Haskeline.LineState</span></a></span><span>
</span><span id="line-4"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Command.html"><span class="hs-identifier">System.Console.Haskeline.Command</span></a></span><span>
</span><span id="line-5"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Key.html"><span class="hs-identifier">System.Console.Haskeline.Key</span></a></span><span>
</span><span id="line-6"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.html#"><span class="hs-identifier">Control.Monad</span></a></span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#liftM"><span class="hs-identifier">liftM</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.Base.html#mplus"><span class="hs-identifier">mplus</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-7"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Monads.html"><span class="hs-identifier">System.Console.Haskeline.Monads</span></a></span><span>
</span><span id="line-8"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.List.html#"><span class="hs-identifier">Data.List</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.OldList.html#isPrefixOf"><span class="hs-identifier">isPrefixOf</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/Data.OldList.html#unfoldr"><span class="hs-identifier">unfoldr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-9"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Maybe.html#"><span class="hs-identifier">Data.Maybe</span></a></span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Maybe.html#fromMaybe"><span class="hs-identifier">fromMaybe</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-10"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="System.Console.Haskeline.History.html"><span class="hs-identifier">System.Console.Haskeline.History</span></a></span><span>
</span><span id="line-11"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.IORef.html#"><span class="hs-identifier">Data.IORef</span></a></span><span>
</span><span id="line-12"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../exceptions/src/Control.Monad.Catch.html#"><span class="hs-identifier">Control.Monad.Catch</span></a></span><span>
</span><span id="line-13"></span><span>
</span><span id="line-14"></span><span class="hs-keyword">data</span><span> </span><span id="HistLog"><span class="annot"><a href="System.Console.Haskeline.Command.History.html#HistLog"><span class="hs-identifier hs-var">HistLog</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="HistLog"><span class="annot"><a href="System.Console.Haskeline.Command.History.html#HistLog"><span class="hs-identifier hs-var">HistLog</span></a></span></span><span> </span><span class="hs-special">{</span><span id="pastHistory"><span class="annot"><span class="annottext">HistLog -&gt; [[Grapheme]]
</span><a href="System.Console.Haskeline.Command.History.html#pastHistory"><span class="hs-identifier hs-var hs-var">pastHistory</span></a></span></span><span class="hs-special">,</span><span> </span><span id="futureHistory"><span class="annot"><span class="annottext">HistLog -&gt; [[Grapheme]]
</span><a href="System.Console.Haskeline.Command.History.html#futureHistory"><span class="hs-identifier hs-var hs-var">futureHistory</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="hs-special">[</span><span class="annot"><a href="System.Console.Haskeline.LineState.html#Grapheme"><span class="hs-identifier hs-type">Grapheme</span></a></span><span class="hs-special">]</span><span class="hs-special">]</span><span class="hs-special">}</span><span>
</span><span id="line-15"></span><span>                    </span><span class="hs-keyword">deriving</span><span> </span><span id="local-6989586621679094358"><span id="local-6989586621679094360"><span id="local-6989586621679094368"><span class="annot"><span class="annottext">Int -&gt; HistLog -&gt; ShowS
[HistLog] -&gt; ShowS
HistLog -&gt; String
(Int -&gt; HistLog -&gt; ShowS)
-&gt; (HistLog -&gt; String) -&gt; ([HistLog] -&gt; ShowS) -&gt; Show HistLog
forall a.
(Int -&gt; a -&gt; ShowS) -&gt; (a -&gt; String) -&gt; ([a] -&gt; ShowS) -&gt; Show a
showList :: [HistLog] -&gt; ShowS
$cshowList :: [HistLog] -&gt; ShowS
show :: HistLog -&gt; String
$cshow :: HistLog -&gt; String
showsPrec :: Int -&gt; HistLog -&gt; ShowS
$cshowsPrec :: Int -&gt; HistLog -&gt; ShowS
</span><a href="../../base/src/GHC.Show.html#Show"><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var">Show</span></a></span></span></span></span><span>
</span><span id="line-16"></span><span>
</span><span id="line-17"></span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#prevHistoryM"><span class="hs-identifier hs-type">prevHistoryM</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="System.Console.Haskeline.LineState.html#Grapheme"><span class="hs-identifier hs-type">Grapheme</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#HistLog"><span class="hs-identifier hs-type">HistLog</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="System.Console.Haskeline.LineState.html#Grapheme"><span class="hs-identifier hs-type">Grapheme</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#HistLog"><span class="hs-identifier hs-type">HistLog</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-18"></span><span id="prevHistoryM"><span class="annot"><span class="annottext">prevHistoryM :: [Grapheme] -&gt; HistLog -&gt; Maybe ([Grapheme], HistLog)
</span><a href="System.Console.Haskeline.Command.History.html#prevHistoryM"><span class="hs-identifier hs-var hs-var">prevHistoryM</span></a></span></span><span> </span><span class="annot"><span class="annottext">[Grapheme]
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#HistLog"><span class="hs-identifier hs-type">HistLog</span></a></span><span> </span><span class="hs-special">{</span><span class="annot"><span class="annottext">pastHistory :: HistLog -&gt; [[Grapheme]]
</span><a href="System.Console.Haskeline.Command.History.html#pastHistory"><span class="hs-identifier hs-var">pastHistory</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">}</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe ([Grapheme], HistLog)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-19"></span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#prevHistoryM"><span class="hs-identifier hs-var">prevHistoryM</span></a></span><span> </span><span id="local-6989586621679094353"><span class="annot"><span class="annottext">[Grapheme]
</span><a href="#local-6989586621679094353"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#HistLog"><span class="hs-identifier hs-type">HistLog</span></a></span><span> </span><span class="hs-special">{</span><span class="annot"><span class="annottext">pastHistory :: HistLog -&gt; [[Grapheme]]
</span><a href="System.Console.Haskeline.Command.History.html#pastHistory"><span class="hs-identifier hs-var">pastHistory</span></a></span><span class="hs-glyph">=</span><span id="local-6989586621679094352"><span class="annot"><span class="annottext">[Grapheme]
</span><a href="#local-6989586621679094352"><span class="hs-identifier hs-var">ls</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621679094351"><span class="annot"><span class="annottext">[[Grapheme]]
</span><a href="#local-6989586621679094351"><span class="hs-identifier hs-var">past</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">futureHistory :: HistLog -&gt; [[Grapheme]]
</span><a href="System.Console.Haskeline.Command.History.html#futureHistory"><span class="hs-identifier hs-var">futureHistory</span></a></span><span class="hs-glyph">=</span><span id="local-6989586621679094350"><span class="annot"><span class="annottext">[[Grapheme]]
</span><a href="#local-6989586621679094350"><span class="hs-identifier hs-var">future</span></a></span></span><span class="hs-special">}</span><span>
</span><span id="line-20"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">([Grapheme], HistLog) -&gt; Maybe ([Grapheme], HistLog)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Grapheme]
</span><a href="#local-6989586621679094352"><span class="hs-identifier hs-var">ls</span></a></span><span class="hs-special">,</span><span> </span><span>
</span><span id="line-21"></span><span>            </span><span class="annot"><span class="annottext">HistLog :: [[Grapheme]] -&gt; [[Grapheme]] -&gt; HistLog
</span><a href="System.Console.Haskeline.Command.History.html#HistLog"><span class="hs-identifier hs-type">HistLog</span></a></span><span> </span><span class="hs-special">{</span><span class="annot"><span class="annottext">pastHistory :: [[Grapheme]]
</span><a href="System.Console.Haskeline.Command.History.html#pastHistory"><span class="hs-identifier hs-var">pastHistory</span></a></span><span class="hs-glyph">=</span><span class="annot"><span class="annottext">[[Grapheme]]
</span><a href="#local-6989586621679094351"><span class="hs-identifier hs-var">past</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">futureHistory :: [[Grapheme]]
</span><a href="System.Console.Haskeline.Command.History.html#futureHistory"><span class="hs-identifier hs-var">futureHistory</span></a></span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Grapheme]
</span><a href="#local-6989586621679094353"><span class="hs-identifier hs-var">s</span></a></span><span class="annot"><span class="annottext">[Grapheme] -&gt; [[Grapheme]] -&gt; [[Grapheme]]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[[Grapheme]]
</span><a href="#local-6989586621679094350"><span class="hs-identifier hs-var">future</span></a></span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-22"></span><span>
</span><span id="line-23"></span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#prevHistories"><span class="hs-identifier hs-type">prevHistories</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="System.Console.Haskeline.LineState.html#Grapheme"><span class="hs-identifier hs-type">Grapheme</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#HistLog"><span class="hs-identifier hs-type">HistLog</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="System.Console.Haskeline.LineState.html#Grapheme"><span class="hs-identifier hs-type">Grapheme</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#HistLog"><span class="hs-identifier hs-type">HistLog</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-24"></span><span id="prevHistories"><span class="annot"><span class="annottext">prevHistories :: [Grapheme] -&gt; HistLog -&gt; [([Grapheme], HistLog)]
</span><a href="System.Console.Haskeline.Command.History.html#prevHistories"><span class="hs-identifier hs-var hs-var">prevHistories</span></a></span></span><span> </span><span id="local-6989586621679094348"><span class="annot"><span class="annottext">[Grapheme]
</span><a href="#local-6989586621679094348"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span id="local-6989586621679094347"><span class="annot"><span class="annottext">HistLog
</span><a href="#local-6989586621679094347"><span class="hs-identifier hs-var">h</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((([Grapheme], HistLog)
  -&gt; Maybe (([Grapheme], HistLog), ([Grapheme], HistLog)))
 -&gt; ([Grapheme], HistLog) -&gt; [([Grapheme], HistLog)])
-&gt; ([Grapheme], HistLog)
-&gt; (([Grapheme], HistLog)
    -&gt; Maybe (([Grapheme], HistLog), ([Grapheme], HistLog)))
-&gt; [([Grapheme], HistLog)]
forall a b c. (a -&gt; b -&gt; c) -&gt; b -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#flip"><span class="hs-identifier hs-var">flip</span></a></span><span> </span><span class="annot"><span class="annottext">(([Grapheme], HistLog)
 -&gt; Maybe (([Grapheme], HistLog), ([Grapheme], HistLog)))
-&gt; ([Grapheme], HistLog) -&gt; [([Grapheme], HistLog)]
forall b a. (b -&gt; Maybe (a, b)) -&gt; b -&gt; [a]
</span><a href="../../base/src/Data.OldList.html#unfoldr"><span class="hs-identifier hs-var">unfoldr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Grapheme]
</span><a href="#local-6989586621679094348"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">HistLog
</span><a href="#local-6989586621679094347"><span class="hs-identifier hs-var">h</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">((([Grapheme], HistLog)
  -&gt; Maybe (([Grapheme], HistLog), ([Grapheme], HistLog)))
 -&gt; [([Grapheme], HistLog)])
-&gt; (([Grapheme], HistLog)
    -&gt; Maybe (([Grapheme], HistLog), ([Grapheme], HistLog)))
-&gt; [([Grapheme], HistLog)]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span class="hs-special">(</span><span id="local-6989586621679094345"><span class="annot"><span class="annottext">[Grapheme]
</span><a href="#local-6989586621679094345"><span class="hs-identifier hs-var">s'</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679094344"><span class="annot"><span class="annottext">HistLog
</span><a href="#local-6989586621679094344"><span class="hs-identifier hs-var">h'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(([Grapheme], HistLog)
 -&gt; (([Grapheme], HistLog), ([Grapheme], HistLog)))
-&gt; Maybe ([Grapheme], HistLog)
-&gt; Maybe (([Grapheme], HistLog), ([Grapheme], HistLog))
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621679094343"><span class="annot"><span class="annottext">([Grapheme], HistLog)
</span><a href="#local-6989586621679094343"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">([Grapheme], HistLog)
</span><a href="#local-6989586621679094343"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">([Grapheme], HistLog)
</span><a href="#local-6989586621679094343"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-25"></span><span>                    </span><span class="annot"><span class="annottext">(Maybe ([Grapheme], HistLog)
 -&gt; Maybe (([Grapheme], HistLog), ([Grapheme], HistLog)))
-&gt; Maybe ([Grapheme], HistLog)
-&gt; Maybe (([Grapheme], HistLog), ([Grapheme], HistLog))
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[Grapheme] -&gt; HistLog -&gt; Maybe ([Grapheme], HistLog)
</span><a href="System.Console.Haskeline.Command.History.html#prevHistoryM"><span class="hs-identifier hs-var">prevHistoryM</span></a></span><span> </span><span class="annot"><span class="annottext">[Grapheme]
</span><a href="#local-6989586621679094345"><span class="hs-identifier hs-var">s'</span></a></span><span> </span><span class="annot"><span class="annottext">HistLog
</span><a href="#local-6989586621679094344"><span class="hs-identifier hs-var">h'</span></a></span><span>
</span><span id="line-26"></span><span>
</span><span id="line-27"></span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#histLog"><span class="hs-identifier hs-type">histLog</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="System.Console.Haskeline.History.html#History"><span class="hs-identifier hs-type">History</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#HistLog"><span class="hs-identifier hs-type">HistLog</span></a></span><span>
</span><span id="line-28"></span><span id="histLog"><span class="annot"><span class="annottext">histLog :: History -&gt; HistLog
</span><a href="System.Console.Haskeline.Command.History.html#histLog"><span class="hs-identifier hs-var hs-var">histLog</span></a></span></span><span> </span><span id="local-6989586621679094341"><span class="annot"><span class="annottext">History
</span><a href="#local-6989586621679094341"><span class="hs-identifier hs-var">hist</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HistLog :: [[Grapheme]] -&gt; [[Grapheme]] -&gt; HistLog
</span><a href="System.Console.Haskeline.Command.History.html#HistLog"><span class="hs-identifier hs-type">HistLog</span></a></span><span> </span><span class="hs-special">{</span><span class="annot"><span class="annottext">pastHistory :: [[Grapheme]]
</span><a href="System.Console.Haskeline.Command.History.html#pastHistory"><span class="hs-identifier hs-var">pastHistory</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(String -&gt; [Grapheme]) -&gt; [String] -&gt; [[Grapheme]]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; [Grapheme]
</span><a href="System.Console.Haskeline.LineState.html#stringToGraphemes"><span class="hs-identifier hs-var">stringToGraphemes</span></a></span><span> </span><span class="annot"><span class="annottext">([String] -&gt; [[Grapheme]]) -&gt; [String] -&gt; [[Grapheme]]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">History -&gt; [String]
</span><a href="System.Console.Haskeline.History.html#historyLines"><span class="hs-identifier hs-var">historyLines</span></a></span><span> </span><span class="annot"><span class="annottext">History
</span><a href="#local-6989586621679094341"><span class="hs-identifier hs-var">hist</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-29"></span><span>                        </span><span class="annot"><span class="annottext">futureHistory :: [[Grapheme]]
</span><a href="System.Console.Haskeline.Command.History.html#futureHistory"><span class="hs-identifier hs-var">futureHistory</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">}</span><span>
</span><span id="line-30"></span><span>
</span><span id="line-31"></span><span id="local-6989586621679094526"><span id="local-6989586621679094530"><span class="annot"><a href="System.Console.Haskeline.Command.History.html#runHistoryFromFile"><span class="hs-identifier hs-type">runHistoryFromFile</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Control.Monad.IO.Class.html#MonadIO"><span class="hs-identifier hs-type">MonadIO</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679094530"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../exceptions/src/Control.Monad.Catch.html#MonadMask"><span class="hs-identifier hs-type">MonadMask</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679094530"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span>
</span><span id="line-32"></span><span>                            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../transformers/src/Control.Monad.Trans.Reader.html#ReaderT"><span class="hs-identifier hs-type">ReaderT</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.IORef.html#IORef"><span class="hs-identifier hs-type">IORef</span></a></span><span> </span><span class="annot"><a href="System.Console.Haskeline.History.html#History"><span class="hs-identifier hs-type">History</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><a href="#local-6989586621679094530"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679094526"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679094530"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679094526"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-33"></span><span id="runHistoryFromFile"><span class="annot"><span class="annottext">runHistoryFromFile :: forall (m :: * -&gt; *) a.
(MonadIO m, MonadMask m) =&gt;
Maybe String -&gt; Maybe Int -&gt; ReaderT (IORef History) m a -&gt; m a
</span><a href="System.Console.Haskeline.Command.History.html#runHistoryFromFile"><span class="hs-identifier hs-var hs-var">runHistoryFromFile</span></a></span></span><span> </span><span class="annot"><span class="annottext">Maybe String
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679094320"><span class="annot"><span class="annottext">ReaderT (IORef History) m a
</span><a href="#local-6989586621679094320"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-34"></span><span>    </span><span id="local-6989586621679094319"><span class="annot"><span class="annottext">IORef History
</span><a href="#local-6989586621679094319"><span class="hs-identifier hs-var">historyRef</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IO (IORef History) -&gt; m (IORef History)
forall (m :: * -&gt; *) a. MonadIO m =&gt; IO a -&gt; m a
</span><a href="../../base/src/Control.Monad.IO.Class.html#liftIO"><span class="hs-identifier hs-var">liftIO</span></a></span><span> </span><span class="annot"><span class="annottext">(IO (IORef History) -&gt; m (IORef History))
-&gt; IO (IORef History) -&gt; m (IORef History)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">History -&gt; IO (IORef History)
forall a. a -&gt; IO (IORef a)
</span><a href="../../base/src/GHC.IORef.html#newIORef"><span class="hs-identifier hs-var">newIORef</span></a></span><span> </span><span class="annot"><span class="annottext">History
</span><a href="System.Console.Haskeline.History.html#emptyHistory"><span class="hs-identifier hs-var">emptyHistory</span></a></span><span>
</span><span id="line-35"></span><span>    </span><span class="annot"><span class="annottext">ReaderT (IORef History) m a -&gt; IORef History -&gt; m a
forall r (m :: * -&gt; *) a. ReaderT r m a -&gt; r -&gt; m a
</span><a href="../../transformers/src/Control.Monad.Trans.Reader.html#runReaderT"><span class="hs-identifier hs-var hs-var">runReaderT</span></a></span><span> </span><span class="annot"><span class="annottext">ReaderT (IORef History) m a
</span><a href="#local-6989586621679094320"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">IORef History
</span><a href="#local-6989586621679094319"><span class="hs-identifier hs-var">historyRef</span></a></span><span>
</span><span id="line-36"></span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#runHistoryFromFile"><span class="hs-identifier hs-var">runHistoryFromFile</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621679094314"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679094314"><span class="hs-identifier hs-var">file</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679094313"><span class="annot"><span class="annottext">Maybe Int
</span><a href="#local-6989586621679094313"><span class="hs-identifier hs-var">stifleAmt</span></a></span></span><span> </span><span id="local-6989586621679094312"><span class="annot"><span class="annottext">ReaderT (IORef History) m a
</span><a href="#local-6989586621679094312"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-37"></span><span>    </span><span id="local-6989586621679094311"><span class="annot"><span class="annottext">History
</span><a href="#local-6989586621679094311"><span class="hs-identifier hs-var">oldHistory</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IO History -&gt; m History
forall (m :: * -&gt; *) a. MonadIO m =&gt; IO a -&gt; m a
</span><a href="../../base/src/Control.Monad.IO.Class.html#liftIO"><span class="hs-identifier hs-var">liftIO</span></a></span><span> </span><span class="annot"><span class="annottext">(IO History -&gt; m History) -&gt; IO History -&gt; m History
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; IO History
</span><a href="System.Console.Haskeline.History.html#readHistory"><span class="hs-identifier hs-var">readHistory</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679094314"><span class="hs-identifier hs-var">file</span></a></span><span>
</span><span id="line-38"></span><span>    </span><span id="local-6989586621679094309"><span class="annot"><span class="annottext">IORef History
</span><a href="#local-6989586621679094309"><span class="hs-identifier hs-var">historyRef</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IO (IORef History) -&gt; m (IORef History)
forall (m :: * -&gt; *) a. MonadIO m =&gt; IO a -&gt; m a
</span><a href="../../base/src/Control.Monad.IO.Class.html#liftIO"><span class="hs-identifier hs-var">liftIO</span></a></span><span> </span><span class="annot"><span class="annottext">(IO (IORef History) -&gt; m (IORef History))
-&gt; IO (IORef History) -&gt; m (IORef History)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">History -&gt; IO (IORef History)
forall a. a -&gt; IO (IORef a)
</span><a href="../../base/src/GHC.IORef.html#newIORef"><span class="hs-identifier hs-var">newIORef</span></a></span><span> </span><span class="annot"><span class="annottext">(History -&gt; IO (IORef History)) -&gt; History -&gt; IO (IORef History)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe Int -&gt; History -&gt; History
</span><a href="System.Console.Haskeline.History.html#stifleHistory"><span class="hs-identifier hs-var">stifleHistory</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe Int
</span><a href="#local-6989586621679094313"><span class="hs-identifier hs-var">stifleAmt</span></a></span><span> </span><span class="annot"><span class="annottext">History
</span><a href="#local-6989586621679094311"><span class="hs-identifier hs-var">oldHistory</span></a></span><span>
</span><span id="line-39"></span><span>    </span><span class="hs-comment">-- Run the action and then write the new history, even on an exception.</span><span>
</span><span id="line-40"></span><span>    </span><span class="hs-comment">-- For example, if there's an unhandled ctrl-c, we don't want to lose</span><span>
</span><span id="line-41"></span><span>    </span><span class="hs-comment">-- the user's previously-entered commands.</span><span>
</span><span id="line-42"></span><span>    </span><span class="hs-comment">-- (Note that this requires using ReaderT (IORef History) instead of StateT.</span><span>
</span><span id="line-43"></span><span>    </span><span id="local-6989586621679094307"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679094307"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ReaderT (IORef History) m a -&gt; IORef History -&gt; m a
forall r (m :: * -&gt; *) a. ReaderT r m a -&gt; r -&gt; m a
</span><a href="../../transformers/src/Control.Monad.Trans.Reader.html#runReaderT"><span class="hs-identifier hs-var hs-var">runReaderT</span></a></span><span> </span><span class="annot"><span class="annottext">ReaderT (IORef History) m a
</span><a href="#local-6989586621679094312"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">IORef History
</span><a href="#local-6989586621679094309"><span class="hs-identifier hs-var">historyRef</span></a></span><span>
</span><span id="line-44"></span><span>            </span><span class="annot"><span class="annottext">m a -&gt; m () -&gt; m a
forall (m :: * -&gt; *) a b. MonadMask m =&gt; m a -&gt; m b -&gt; m a
</span><a href="../../exceptions/src/Control.Monad.Catch.html#finally"><span class="hs-operator hs-var">`finally`</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IO () -&gt; m ()
forall (m :: * -&gt; *) a. MonadIO m =&gt; IO a -&gt; m a
</span><a href="../../base/src/Control.Monad.IO.Class.html#liftIO"><span class="hs-identifier hs-var">liftIO</span></a></span><span> </span><span class="annot"><span class="annottext">(IO () -&gt; m ()) -&gt; IO () -&gt; m ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">IORef History -&gt; IO History
forall a. IORef a -&gt; IO a
</span><a href="../../base/src/GHC.IORef.html#readIORef"><span class="hs-identifier hs-var">readIORef</span></a></span><span> </span><span class="annot"><span class="annottext">IORef History
</span><a href="#local-6989586621679094309"><span class="hs-identifier hs-var">historyRef</span></a></span><span> </span><span class="annot"><span class="annottext">IO History -&gt; (History -&gt; IO ()) -&gt; IO ()
forall (m :: * -&gt; *) a b. Monad m =&gt; m a -&gt; (a -&gt; m b) -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3E%3E%3D"><span class="hs-operator hs-var">&gt;&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; History -&gt; IO ()
</span><a href="System.Console.Haskeline.History.html#writeHistory"><span class="hs-identifier hs-var">writeHistory</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679094314"><span class="hs-identifier hs-var">file</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-45"></span><span>    </span><span class="annot"><span class="annottext">a -&gt; m a
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679094307"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-46"></span><span>
</span><span id="line-47"></span><span id="local-6989586621679094508"><span class="annot"><a href="System.Console.Haskeline.Command.History.html#prevHistory"><span class="hs-identifier hs-type">prevHistory</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#firstHistory"><span class="hs-identifier hs-type">firstHistory</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="System.Console.Haskeline.LineState.html#Save"><span class="hs-identifier hs-type">Save</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679094508"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679094508"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#HistLog"><span class="hs-identifier hs-type">HistLog</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679094508"><span class="hs-identifier hs-type">s</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#HistLog"><span class="hs-identifier hs-type">HistLog</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-48"></span><span id="prevHistory"><span class="annot"><span class="annottext">prevHistory :: forall s. Save s =&gt; s -&gt; HistLog -&gt; (s, HistLog)
</span><a href="System.Console.Haskeline.Command.History.html#prevHistory"><span class="hs-identifier hs-var hs-var">prevHistory</span></a></span></span><span> </span><span id="local-6989586621679094299"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679094299"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span id="local-6989586621679094298"><span class="annot"><span class="annottext">HistLog
</span><a href="#local-6989586621679094298"><span class="hs-identifier hs-var">h</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679094295"><span class="annot"><span class="annottext">[Grapheme]
</span><a href="#local-6989586621679094295"><span class="hs-identifier hs-var">s'</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679094294"><span class="annot"><span class="annottext">HistLog
</span><a href="#local-6989586621679094294"><span class="hs-identifier hs-var">h'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">([Grapheme], HistLog)
-&gt; Maybe ([Grapheme], HistLog) -&gt; ([Grapheme], HistLog)
forall a. a -&gt; Maybe a -&gt; a
</span><a href="../../base/src/Data.Maybe.html#fromMaybe"><span class="hs-identifier hs-var">fromMaybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">s -&gt; [Grapheme]
forall s. Save s =&gt; s -&gt; [Grapheme]
</span><a href="System.Console.Haskeline.LineState.html#listSave"><span class="hs-identifier hs-var">listSave</span></a></span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679094299"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">HistLog
</span><a href="#local-6989586621679094298"><span class="hs-identifier hs-var">h</span></a></span><span class="hs-special">)</span><span> </span><span>
</span><span id="line-49"></span><span>                                    </span><span class="annot"><span class="annottext">(Maybe ([Grapheme], HistLog) -&gt; ([Grapheme], HistLog))
-&gt; Maybe ([Grapheme], HistLog) -&gt; ([Grapheme], HistLog)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[Grapheme] -&gt; HistLog -&gt; Maybe ([Grapheme], HistLog)
</span><a href="System.Console.Haskeline.Command.History.html#prevHistoryM"><span class="hs-identifier hs-var">prevHistoryM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">s -&gt; [Grapheme]
forall s. Save s =&gt; s -&gt; [Grapheme]
</span><a href="System.Console.Haskeline.LineState.html#listSave"><span class="hs-identifier hs-var">listSave</span></a></span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679094299"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">HistLog
</span><a href="#local-6989586621679094298"><span class="hs-identifier hs-var">h</span></a></span><span>
</span><span id="line-50"></span><span>                  </span><span class="hs-keyword">in</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Grapheme] -&gt; s
forall s. Save s =&gt; [Grapheme] -&gt; s
</span><a href="System.Console.Haskeline.LineState.html#listRestore"><span class="hs-identifier hs-var">listRestore</span></a></span><span> </span><span class="annot"><span class="annottext">[Grapheme]
</span><a href="#local-6989586621679094295"><span class="hs-identifier hs-var">s'</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">HistLog
</span><a href="#local-6989586621679094294"><span class="hs-identifier hs-var">h'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-51"></span><span>
</span><span id="line-52"></span><span id="firstHistory"><span class="annot"><span class="annottext">firstHistory :: forall s. Save s =&gt; s -&gt; HistLog -&gt; (s, HistLog)
</span><a href="System.Console.Haskeline.Command.History.html#firstHistory"><span class="hs-identifier hs-var hs-var">firstHistory</span></a></span></span><span> </span><span id="local-6989586621679094289"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679094289"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span id="local-6989586621679094288"><span class="annot"><span class="annottext">HistLog
</span><a href="#local-6989586621679094288"><span class="hs-identifier hs-var">h</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679094285"><span class="annot"><span class="annottext">prevs :: [([Grapheme], HistLog)]
</span><a href="#local-6989586621679094285"><span class="hs-identifier hs-var hs-var">prevs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">s -&gt; [Grapheme]
forall s. Save s =&gt; s -&gt; [Grapheme]
</span><a href="System.Console.Haskeline.LineState.html#listSave"><span class="hs-identifier hs-var">listSave</span></a></span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679094289"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">HistLog
</span><a href="#local-6989586621679094288"><span class="hs-identifier hs-var">h</span></a></span><span class="hs-special">)</span><span class="annot"><span class="annottext">([Grapheme], HistLog)
-&gt; [([Grapheme], HistLog)] -&gt; [([Grapheme], HistLog)]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[Grapheme] -&gt; HistLog -&gt; [([Grapheme], HistLog)]
</span><a href="System.Console.Haskeline.Command.History.html#prevHistories"><span class="hs-identifier hs-var">prevHistories</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">s -&gt; [Grapheme]
forall s. Save s =&gt; s -&gt; [Grapheme]
</span><a href="System.Console.Haskeline.LineState.html#listSave"><span class="hs-identifier hs-var">listSave</span></a></span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679094289"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">HistLog
</span><a href="#local-6989586621679094288"><span class="hs-identifier hs-var">h</span></a></span><span>
</span><span id="line-53"></span><span>                       </span><span class="hs-comment">-- above makes sure we don't take the last of an empty list.</span><span>
</span><span id="line-54"></span><span>                       </span><span class="hs-special">(</span><span id="local-6989586621679094284"><span class="annot"><span class="annottext">[Grapheme]
</span><a href="#local-6989586621679094284"><span class="hs-identifier hs-var">s'</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679094283"><span class="annot"><span class="annottext">HistLog
</span><a href="#local-6989586621679094283"><span class="hs-identifier hs-var">h'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[([Grapheme], HistLog)] -&gt; ([Grapheme], HistLog)
forall a. [a] -&gt; a
</span><a href="../../base/src/GHC.List.html#last"><span class="hs-identifier hs-var">last</span></a></span><span> </span><span class="annot"><span class="annottext">[([Grapheme], HistLog)]
</span><a href="#local-6989586621679094285"><span class="hs-identifier hs-var">prevs</span></a></span><span>
</span><span id="line-55"></span><span>                   </span><span class="hs-keyword">in</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Grapheme] -&gt; s
forall s. Save s =&gt; [Grapheme] -&gt; s
</span><a href="System.Console.Haskeline.LineState.html#listRestore"><span class="hs-identifier hs-var">listRestore</span></a></span><span> </span><span class="annot"><span class="annottext">[Grapheme]
</span><a href="#local-6989586621679094284"><span class="hs-identifier hs-var">s'</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">HistLog
</span><a href="#local-6989586621679094283"><span class="hs-identifier hs-var">h'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-56"></span><span>
</span><span id="line-57"></span><span id="local-6989586621679094500"><span id="local-6989586621679094501"><span class="annot"><a href="System.Console.Haskeline.Command.History.html#historyBack"><span class="hs-identifier hs-type">historyBack</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#historyForward"><span class="hs-identifier hs-type">historyForward</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="System.Console.Haskeline.LineState.html#Save"><span class="hs-identifier hs-type">Save</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679094501"><span class="hs-identifier hs-type">s</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Monads.html#MonadState"><span class="hs-identifier hs-type">MonadState</span></a></span><span> </span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#HistLog"><span class="hs-identifier hs-type">HistLog</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679094500"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Command.html#Command"><span class="hs-identifier hs-type">Command</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679094500"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679094501"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679094501"><span class="hs-identifier hs-type">s</span></a></span></span></span><span>
</span><span id="line-58"></span><span id="historyBack"><span class="annot"><span class="annottext">historyBack :: forall s (m :: * -&gt; *).
(Save s, MonadState HistLog m) =&gt;
Command m s s
</span><a href="System.Console.Haskeline.Command.History.html#historyBack"><span class="hs-identifier hs-var hs-var">historyBack</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(s -&gt; m (Either Effect s)) -&gt; Command m s s
forall s (m :: * -&gt; *).
(LineState s, Monad m) =&gt;
(s -&gt; m (Either Effect s)) -&gt; Command m s s
</span><a href="System.Console.Haskeline.Command.html#simpleCommand"><span class="hs-identifier hs-var">simpleCommand</span></a></span><span> </span><span class="annot"><span class="annottext">((s -&gt; m (Either Effect s)) -&gt; Command m s s)
-&gt; (s -&gt; m (Either Effect s)) -&gt; Command m s s
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(s -&gt; HistLog -&gt; (s, HistLog)) -&gt; s -&gt; m (Either Effect s)
forall (m :: * -&gt; *) s t.
MonadState HistLog m =&gt;
(s -&gt; HistLog -&gt; (t, HistLog)) -&gt; s -&gt; m (Either Effect t)
</span><a href="System.Console.Haskeline.Command.History.html#histUpdate"><span class="hs-identifier hs-var">histUpdate</span></a></span><span> </span><span class="annot"><span class="annottext">s -&gt; HistLog -&gt; (s, HistLog)
forall s. Save s =&gt; s -&gt; HistLog -&gt; (s, HistLog)
</span><a href="System.Console.Haskeline.Command.History.html#prevHistory"><span class="hs-identifier hs-var">prevHistory</span></a></span><span>
</span><span id="line-59"></span><span id="historyForward"><span class="annot"><span class="annottext">historyForward :: forall s (m :: * -&gt; *).
(Save s, MonadState HistLog m) =&gt;
Command m s s
</span><a href="System.Console.Haskeline.Command.History.html#historyForward"><span class="hs-identifier hs-var hs-var">historyForward</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(s -&gt; m (Either Effect s)) -&gt; Command m s s
forall s (m :: * -&gt; *).
(LineState s, Monad m) =&gt;
(s -&gt; m (Either Effect s)) -&gt; Command m s s
</span><a href="System.Console.Haskeline.Command.html#simpleCommand"><span class="hs-identifier hs-var">simpleCommand</span></a></span><span> </span><span class="annot"><span class="annottext">((s -&gt; m (Either Effect s)) -&gt; Command m s s)
-&gt; (s -&gt; m (Either Effect s)) -&gt; Command m s s
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">m (Either Effect s) -&gt; m (Either Effect s)
forall (m :: * -&gt; *) b. MonadState HistLog m =&gt; m b -&gt; m b
</span><a href="System.Console.Haskeline.Command.History.html#reverseHist"><span class="hs-identifier hs-var">reverseHist</span></a></span><span> </span><span class="annot"><span class="annottext">(m (Either Effect s) -&gt; m (Either Effect s))
-&gt; (s -&gt; m (Either Effect s)) -&gt; s -&gt; m (Either Effect s)
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">(s -&gt; HistLog -&gt; (s, HistLog)) -&gt; s -&gt; m (Either Effect s)
forall (m :: * -&gt; *) s t.
MonadState HistLog m =&gt;
(s -&gt; HistLog -&gt; (t, HistLog)) -&gt; s -&gt; m (Either Effect t)
</span><a href="System.Console.Haskeline.Command.History.html#histUpdate"><span class="hs-identifier hs-var">histUpdate</span></a></span><span> </span><span class="annot"><span class="annottext">s -&gt; HistLog -&gt; (s, HistLog)
forall s. Save s =&gt; s -&gt; HistLog -&gt; (s, HistLog)
</span><a href="System.Console.Haskeline.Command.History.html#prevHistory"><span class="hs-identifier hs-var">prevHistory</span></a></span><span>
</span><span id="line-60"></span><span>
</span><span id="line-61"></span><span id="local-6989586621679094255"><span id="local-6989586621679094256"><span class="annot"><a href="System.Console.Haskeline.Command.History.html#historyStart"><span class="hs-identifier hs-type">historyStart</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#historyEnd"><span class="hs-identifier hs-type">historyEnd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="System.Console.Haskeline.LineState.html#Save"><span class="hs-identifier hs-type">Save</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679094256"><span class="hs-identifier hs-type">s</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Monads.html#MonadState"><span class="hs-identifier hs-type">MonadState</span></a></span><span> </span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#HistLog"><span class="hs-identifier hs-type">HistLog</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679094255"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Command.html#Command"><span class="hs-identifier hs-type">Command</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679094255"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679094256"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679094256"><span class="hs-identifier hs-type">s</span></a></span></span></span><span>
</span><span id="line-62"></span><span id="historyStart"><span class="annot"><span class="annottext">historyStart :: forall s (m :: * -&gt; *).
(Save s, MonadState HistLog m) =&gt;
Command m s s
</span><a href="System.Console.Haskeline.Command.History.html#historyStart"><span class="hs-identifier hs-var hs-var">historyStart</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(s -&gt; m (Either Effect s)) -&gt; Command m s s
forall s (m :: * -&gt; *).
(LineState s, Monad m) =&gt;
(s -&gt; m (Either Effect s)) -&gt; Command m s s
</span><a href="System.Console.Haskeline.Command.html#simpleCommand"><span class="hs-identifier hs-var">simpleCommand</span></a></span><span> </span><span class="annot"><span class="annottext">((s -&gt; m (Either Effect s)) -&gt; Command m s s)
-&gt; (s -&gt; m (Either Effect s)) -&gt; Command m s s
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(s -&gt; HistLog -&gt; (s, HistLog)) -&gt; s -&gt; m (Either Effect s)
forall (m :: * -&gt; *) s t.
MonadState HistLog m =&gt;
(s -&gt; HistLog -&gt; (t, HistLog)) -&gt; s -&gt; m (Either Effect t)
</span><a href="System.Console.Haskeline.Command.History.html#histUpdate"><span class="hs-identifier hs-var">histUpdate</span></a></span><span> </span><span class="annot"><span class="annottext">s -&gt; HistLog -&gt; (s, HistLog)
forall s. Save s =&gt; s -&gt; HistLog -&gt; (s, HistLog)
</span><a href="System.Console.Haskeline.Command.History.html#firstHistory"><span class="hs-identifier hs-var">firstHistory</span></a></span><span>
</span><span id="line-63"></span><span id="historyEnd"><span class="annot"><span class="annottext">historyEnd :: forall s (m :: * -&gt; *).
(Save s, MonadState HistLog m) =&gt;
Command m s s
</span><a href="System.Console.Haskeline.Command.History.html#historyEnd"><span class="hs-identifier hs-var hs-var">historyEnd</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(s -&gt; m (Either Effect s)) -&gt; Command m s s
forall s (m :: * -&gt; *).
(LineState s, Monad m) =&gt;
(s -&gt; m (Either Effect s)) -&gt; Command m s s
</span><a href="System.Console.Haskeline.Command.html#simpleCommand"><span class="hs-identifier hs-var">simpleCommand</span></a></span><span> </span><span class="annot"><span class="annottext">((s -&gt; m (Either Effect s)) -&gt; Command m s s)
-&gt; (s -&gt; m (Either Effect s)) -&gt; Command m s s
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">m (Either Effect s) -&gt; m (Either Effect s)
forall (m :: * -&gt; *) b. MonadState HistLog m =&gt; m b -&gt; m b
</span><a href="System.Console.Haskeline.Command.History.html#reverseHist"><span class="hs-identifier hs-var">reverseHist</span></a></span><span> </span><span class="annot"><span class="annottext">(m (Either Effect s) -&gt; m (Either Effect s))
-&gt; (s -&gt; m (Either Effect s)) -&gt; s -&gt; m (Either Effect s)
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">(s -&gt; HistLog -&gt; (s, HistLog)) -&gt; s -&gt; m (Either Effect s)
forall (m :: * -&gt; *) s t.
MonadState HistLog m =&gt;
(s -&gt; HistLog -&gt; (t, HistLog)) -&gt; s -&gt; m (Either Effect t)
</span><a href="System.Console.Haskeline.Command.History.html#histUpdate"><span class="hs-identifier hs-var">histUpdate</span></a></span><span> </span><span class="annot"><span class="annottext">s -&gt; HistLog -&gt; (s, HistLog)
forall s. Save s =&gt; s -&gt; HistLog -&gt; (s, HistLog)
</span><a href="System.Console.Haskeline.Command.History.html#firstHistory"><span class="hs-identifier hs-var">firstHistory</span></a></span><span>
</span><span id="line-64"></span><span>
</span><span id="line-65"></span><span id="local-6989586621679094486"><span id="local-6989586621679094487"><span id="local-6989586621679094488"><span class="annot"><a href="System.Console.Haskeline.Command.History.html#histUpdate"><span class="hs-identifier hs-type">histUpdate</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Monads.html#MonadState"><span class="hs-identifier hs-type">MonadState</span></a></span><span> </span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#HistLog"><span class="hs-identifier hs-type">HistLog</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679094488"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679094487"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#HistLog"><span class="hs-identifier hs-type">HistLog</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679094486"><span class="hs-identifier hs-type">t</span></a></span><span class="hs-special">,</span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#HistLog"><span class="hs-identifier hs-type">HistLog</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-66"></span><span>                        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679094487"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679094488"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Either.html#Either"><span class="hs-identifier hs-type">Either</span></a></span><span> </span><span class="annot"><a href="System.Console.Haskeline.Command.html#Effect"><span class="hs-identifier hs-type">Effect</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679094486"><span class="hs-identifier hs-type">t</span></a></span><span class="hs-special">)</span></span></span></span><span>
</span><span id="line-67"></span><span id="histUpdate"><span class="annot"><span class="annottext">histUpdate :: forall (m :: * -&gt; *) s t.
MonadState HistLog m =&gt;
(s -&gt; HistLog -&gt; (t, HistLog)) -&gt; s -&gt; m (Either Effect t)
</span><a href="System.Console.Haskeline.Command.History.html#histUpdate"><span class="hs-identifier hs-var hs-var">histUpdate</span></a></span></span><span> </span><span id="local-6989586621679094231"><span class="annot"><span class="annottext">s -&gt; HistLog -&gt; (t, HistLog)
</span><a href="#local-6989586621679094231"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(t -&gt; Either Effect t) -&gt; m t -&gt; m (Either Effect t)
forall (m :: * -&gt; *) a1 r. Monad m =&gt; (a1 -&gt; r) -&gt; m a1 -&gt; m r
</span><a href="../../base/src/GHC.Base.html#liftM"><span class="hs-identifier hs-var">liftM</span></a></span><span> </span><span class="annot"><span class="annottext">t -&gt; Either Effect t
forall a b. b -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Right"><span class="hs-identifier hs-var">Right</span></a></span><span> </span><span class="annot"><span class="annottext">(m t -&gt; m (Either Effect t))
-&gt; (s -&gt; m t) -&gt; s -&gt; m (Either Effect t)
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">(HistLog -&gt; (t, HistLog)) -&gt; m t
forall s (m :: * -&gt; *) a. MonadState s m =&gt; (s -&gt; (a, s)) -&gt; m a
</span><a href="System.Console.Haskeline.Monads.html#update"><span class="hs-identifier hs-var">update</span></a></span><span> </span><span class="annot"><span class="annottext">((HistLog -&gt; (t, HistLog)) -&gt; m t)
-&gt; (s -&gt; HistLog -&gt; (t, HistLog)) -&gt; s -&gt; m t
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">s -&gt; HistLog -&gt; (t, HistLog)
</span><a href="#local-6989586621679094231"><span class="hs-identifier hs-var">f</span></a></span><span>
</span><span id="line-68"></span><span>
</span><span id="line-69"></span><span id="local-6989586621679094482"><span id="local-6989586621679094483"><span class="annot"><a href="System.Console.Haskeline.Command.History.html#reverseHist"><span class="hs-identifier hs-type">reverseHist</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Monads.html#MonadState"><span class="hs-identifier hs-type">MonadState</span></a></span><span> </span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#HistLog"><span class="hs-identifier hs-type">HistLog</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679094483"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679094483"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679094482"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679094483"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679094482"><span class="hs-identifier hs-type">b</span></a></span></span></span><span>
</span><span id="line-70"></span><span id="reverseHist"><span class="annot"><span class="annottext">reverseHist :: forall (m :: * -&gt; *) b. MonadState HistLog m =&gt; m b -&gt; m b
</span><a href="System.Console.Haskeline.Command.History.html#reverseHist"><span class="hs-identifier hs-var hs-var">reverseHist</span></a></span></span><span> </span><span id="local-6989586621679094221"><span class="annot"><span class="annottext">m b
</span><a href="#local-6989586621679094221"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-71"></span><span>    </span><span class="annot"><span class="annottext">(HistLog -&gt; HistLog) -&gt; m ()
forall s (m :: * -&gt; *). MonadState s m =&gt; (s -&gt; s) -&gt; m ()
</span><a href="System.Console.Haskeline.Monads.html#modify"><span class="hs-identifier hs-var">modify</span></a></span><span> </span><span class="annot"><span class="annottext">HistLog -&gt; HistLog
</span><a href="#local-6989586621679094219"><span class="hs-identifier hs-var">reverser</span></a></span><span>
</span><span id="line-72"></span><span>    </span><span id="local-6989586621679094218"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679094218"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">m b
</span><a href="#local-6989586621679094221"><span class="hs-identifier hs-var">f</span></a></span><span>
</span><span id="line-73"></span><span>    </span><span class="annot"><span class="annottext">(HistLog -&gt; HistLog) -&gt; m ()
forall s (m :: * -&gt; *). MonadState s m =&gt; (s -&gt; s) -&gt; m ()
</span><a href="System.Console.Haskeline.Monads.html#modify"><span class="hs-identifier hs-var">modify</span></a></span><span> </span><span class="annot"><span class="annottext">HistLog -&gt; HistLog
</span><a href="#local-6989586621679094219"><span class="hs-identifier hs-var">reverser</span></a></span><span>
</span><span id="line-74"></span><span>    </span><span class="annot"><span class="annottext">b -&gt; m b
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679094218"><span class="hs-identifier hs-var">y</span></a></span><span>
</span><span id="line-75"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-76"></span><span>    </span><span id="local-6989586621679094219"><span class="annot"><span class="annottext">reverser :: HistLog -&gt; HistLog
</span><a href="#local-6989586621679094219"><span class="hs-identifier hs-var hs-var">reverser</span></a></span></span><span> </span><span id="local-6989586621679094217"><span class="annot"><span class="annottext">HistLog
</span><a href="#local-6989586621679094217"><span class="hs-identifier hs-var">h</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HistLog :: [[Grapheme]] -&gt; [[Grapheme]] -&gt; HistLog
</span><a href="System.Console.Haskeline.Command.History.html#HistLog"><span class="hs-identifier hs-type">HistLog</span></a></span><span> </span><span class="hs-special">{</span><span class="annot"><span class="annottext">futureHistory :: [[Grapheme]]
</span><a href="System.Console.Haskeline.Command.History.html#futureHistory"><span class="hs-identifier hs-var">futureHistory</span></a></span><span class="hs-glyph">=</span><span class="annot"><span class="annottext">HistLog -&gt; [[Grapheme]]
</span><a href="System.Console.Haskeline.Command.History.html#pastHistory"><span class="hs-identifier hs-var hs-var">pastHistory</span></a></span><span> </span><span class="annot"><span class="annottext">HistLog
</span><a href="#local-6989586621679094217"><span class="hs-identifier hs-var">h</span></a></span><span class="hs-special">,</span><span> </span><span>
</span><span id="line-77"></span><span>                            </span><span class="annot"><span class="annottext">pastHistory :: [[Grapheme]]
</span><a href="System.Console.Haskeline.Command.History.html#pastHistory"><span class="hs-identifier hs-var">pastHistory</span></a></span><span class="hs-glyph">=</span><span class="annot"><span class="annottext">HistLog -&gt; [[Grapheme]]
</span><a href="System.Console.Haskeline.Command.History.html#futureHistory"><span class="hs-identifier hs-var hs-var">futureHistory</span></a></span><span> </span><span class="annot"><span class="annottext">HistLog
</span><a href="#local-6989586621679094217"><span class="hs-identifier hs-var">h</span></a></span><span class="hs-special">}</span><span>
</span><span id="line-78"></span><span>
</span><span id="line-79"></span><span class="hs-keyword">data</span><span> </span><span id="SearchMode"><span class="annot"><a href="System.Console.Haskeline.Command.History.html#SearchMode"><span class="hs-identifier hs-var">SearchMode</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="SearchMode"><span class="annot"><a href="System.Console.Haskeline.Command.History.html#SearchMode"><span class="hs-identifier hs-var">SearchMode</span></a></span></span><span> </span><span class="hs-special">{</span><span id="searchTerm"><span class="annot"><span class="annottext">SearchMode -&gt; [Grapheme]
</span><a href="System.Console.Haskeline.Command.History.html#searchTerm"><span class="hs-identifier hs-var hs-var">searchTerm</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="System.Console.Haskeline.LineState.html#Grapheme"><span class="hs-identifier hs-type">Grapheme</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span>
</span><span id="line-80"></span><span>                              </span><span id="foundHistory"><span class="annot"><span class="annottext">SearchMode -&gt; InsertMode
</span><a href="System.Console.Haskeline.Command.History.html#foundHistory"><span class="hs-identifier hs-var hs-var">foundHistory</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="System.Console.Haskeline.LineState.html#InsertMode"><span class="hs-identifier hs-type">InsertMode</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-81"></span><span>                              </span><span id="direction"><span class="annot"><span class="annottext">SearchMode -&gt; Direction
</span><a href="System.Console.Haskeline.Command.History.html#direction"><span class="hs-identifier hs-var hs-var">direction</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#Direction"><span class="hs-identifier hs-type">Direction</span></a></span><span class="hs-special">}</span><span>
</span><span id="line-82"></span><span>                        </span><span class="hs-keyword">deriving</span><span> </span><span id="local-6989586621679094201"><span id="local-6989586621679094203"><span id="local-6989586621679094211"><span class="annot"><span class="annottext">Int -&gt; SearchMode -&gt; ShowS
[SearchMode] -&gt; ShowS
SearchMode -&gt; String
(Int -&gt; SearchMode -&gt; ShowS)
-&gt; (SearchMode -&gt; String)
-&gt; ([SearchMode] -&gt; ShowS)
-&gt; Show SearchMode
forall a.
(Int -&gt; a -&gt; ShowS) -&gt; (a -&gt; String) -&gt; ([a] -&gt; ShowS) -&gt; Show a
showList :: [SearchMode] -&gt; ShowS
$cshowList :: [SearchMode] -&gt; ShowS
show :: SearchMode -&gt; String
$cshow :: SearchMode -&gt; String
showsPrec :: Int -&gt; SearchMode -&gt; ShowS
$cshowsPrec :: Int -&gt; SearchMode -&gt; ShowS
</span><a href="../../base/src/GHC.Show.html#Show"><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var">Show</span></a></span></span></span></span><span>
</span><span id="line-83"></span><span>
</span><span id="line-84"></span><span class="hs-keyword">data</span><span> </span><span id="Direction"><span class="annot"><a href="System.Console.Haskeline.Command.History.html#Direction"><span class="hs-identifier hs-var">Direction</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="Forward"><span class="annot"><a href="System.Console.Haskeline.Command.History.html#Forward"><span class="hs-identifier hs-var">Forward</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span id="Reverse"><span class="annot"><a href="System.Console.Haskeline.Command.History.html#Reverse"><span class="hs-identifier hs-var">Reverse</span></a></span></span><span>
</span><span id="line-85"></span><span>                    </span><span class="hs-keyword">deriving</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679094193"><span id="local-6989586621679094195"><span id="local-6989586621679094197"><span class="annot"><span class="annottext">Int -&gt; Direction -&gt; ShowS
[Direction] -&gt; ShowS
Direction -&gt; String
(Int -&gt; Direction -&gt; ShowS)
-&gt; (Direction -&gt; String)
-&gt; ([Direction] -&gt; ShowS)
-&gt; Show Direction
forall a.
(Int -&gt; a -&gt; ShowS) -&gt; (a -&gt; String) -&gt; ([a] -&gt; ShowS) -&gt; Show a
showList :: [Direction] -&gt; ShowS
$cshowList :: [Direction] -&gt; ShowS
show :: Direction -&gt; String
$cshow :: Direction -&gt; String
showsPrec :: Int -&gt; Direction -&gt; ShowS
$cshowsPrec :: Int -&gt; Direction -&gt; ShowS
</span><a href="../../base/src/GHC.Show.html#Show"><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var">Show</span></a></span></span></span></span><span class="hs-special">,</span><span id="local-6989586621679094189"><span id="local-6989586621679094191"><span class="annot"><span class="annottext">Direction -&gt; Direction -&gt; Bool
(Direction -&gt; Direction -&gt; Bool)
-&gt; (Direction -&gt; Direction -&gt; Bool) -&gt; Eq Direction
forall a. (a -&gt; a -&gt; Bool) -&gt; (a -&gt; a -&gt; Bool) -&gt; Eq a
/= :: Direction -&gt; Direction -&gt; Bool
$c/= :: Direction -&gt; Direction -&gt; Bool
== :: Direction -&gt; Direction -&gt; Bool
$c== :: Direction -&gt; Direction -&gt; Bool
</span><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var">Eq</span></span></span></span><span class="hs-special">)</span><span>
</span><span id="line-86"></span><span>
</span><span id="line-87"></span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#directionName"><span class="hs-identifier hs-type">directionName</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#Direction"><span class="hs-identifier hs-type">Direction</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>
</span><span id="line-88"></span><span id="directionName"><span class="annot"><span class="annottext">directionName :: Direction -&gt; String
</span><a href="System.Console.Haskeline.Command.History.html#directionName"><span class="hs-identifier hs-var hs-var">directionName</span></a></span></span><span> </span><span class="annot"><span class="annottext">Direction
</span><a href="System.Console.Haskeline.Command.History.html#Forward"><span class="hs-identifier hs-var">Forward</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;i-search&quot;</span></span><span>
</span><span id="line-89"></span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#directionName"><span class="hs-identifier hs-var">directionName</span></a></span><span> </span><span class="annot"><span class="annottext">Direction
</span><a href="System.Console.Haskeline.Command.History.html#Reverse"><span class="hs-identifier hs-var">Reverse</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;reverse-i-search&quot;</span></span><span>
</span><span id="line-90"></span><span>
</span><span id="line-91"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="System.Console.Haskeline.LineState.html#LineState"><span class="hs-identifier hs-type">LineState</span></a></span><span> </span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#SearchMode"><span class="hs-identifier hs-type">SearchMode</span></a></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-92"></span><span>    </span><span id="local-6989586621679094180"><span class="annot"><span class="annottext">beforeCursor :: [Grapheme] -&gt; SearchMode -&gt; [Grapheme]
</span><a href="System.Console.Haskeline.LineState.html#beforeCursor"><span class="hs-identifier hs-var hs-var hs-var hs-var">beforeCursor</span></a></span></span><span> </span><span class="annot"><span class="annottext">[Grapheme]
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679094178"><span class="annot"><span class="annottext">SearchMode
</span><a href="#local-6989586621679094178"><span class="hs-identifier hs-var">sm</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Grapheme] -&gt; InsertMode -&gt; [Grapheme]
forall s. LineState s =&gt; [Grapheme] -&gt; s -&gt; [Grapheme]
</span><a href="System.Console.Haskeline.LineState.html#beforeCursor"><span class="hs-identifier hs-var">beforeCursor</span></a></span><span> </span><span class="annot"><span class="annottext">[Grapheme]
</span><a href="#local-6989586621679094177"><span class="hs-identifier hs-var">prefix</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SearchMode -&gt; InsertMode
</span><a href="System.Console.Haskeline.Command.History.html#foundHistory"><span class="hs-identifier hs-var hs-var">foundHistory</span></a></span><span> </span><span class="annot"><span class="annottext">SearchMode
</span><a href="#local-6989586621679094178"><span class="hs-identifier hs-var">sm</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-93"></span><span>        </span><span class="hs-keyword">where</span><span> </span><span>
</span><span id="line-94"></span><span>            </span><span id="local-6989586621679094177"><span class="annot"><span class="annottext">prefix :: [Grapheme]
</span><a href="#local-6989586621679094177"><span class="hs-identifier hs-var hs-var">prefix</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; [Grapheme]
</span><a href="System.Console.Haskeline.LineState.html#stringToGraphemes"><span class="hs-identifier hs-var">stringToGraphemes</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;(&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; ShowS
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">Direction -&gt; String
</span><a href="System.Console.Haskeline.Command.History.html#directionName"><span class="hs-identifier hs-var">directionName</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SearchMode -&gt; Direction
</span><a href="System.Console.Haskeline.Command.History.html#direction"><span class="hs-identifier hs-var hs-var">direction</span></a></span><span> </span><span class="annot"><span class="annottext">SearchMode
</span><a href="#local-6989586621679094178"><span class="hs-identifier hs-var">sm</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">String -&gt; ShowS
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;)`&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-95"></span><span>                            </span><span class="annot"><span class="annottext">[Grapheme] -&gt; [Grapheme] -&gt; [Grapheme]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">SearchMode -&gt; [Grapheme]
</span><a href="System.Console.Haskeline.Command.History.html#searchTerm"><span class="hs-identifier hs-var hs-var">searchTerm</span></a></span><span> </span><span class="annot"><span class="annottext">SearchMode
</span><a href="#local-6989586621679094178"><span class="hs-identifier hs-var">sm</span></a></span><span> </span><span class="annot"><span class="annottext">[Grapheme] -&gt; [Grapheme] -&gt; [Grapheme]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; [Grapheme]
</span><a href="System.Console.Haskeline.LineState.html#stringToGraphemes"><span class="hs-identifier hs-var">stringToGraphemes</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;': &quot;</span></span><span>
</span><span id="line-96"></span><span>    </span><span id="local-6989586621679094175"><span class="annot"><span class="annottext">afterCursor :: SearchMode -&gt; [Grapheme]
</span><a href="System.Console.Haskeline.LineState.html#afterCursor"><span class="hs-identifier hs-var hs-var hs-var hs-var">afterCursor</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InsertMode -&gt; [Grapheme]
forall s. LineState s =&gt; s -&gt; [Grapheme]
</span><a href="System.Console.Haskeline.LineState.html#afterCursor"><span class="hs-identifier hs-var">afterCursor</span></a></span><span> </span><span class="annot"><span class="annottext">(InsertMode -&gt; [Grapheme])
-&gt; (SearchMode -&gt; InsertMode) -&gt; SearchMode -&gt; [Grapheme]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">SearchMode -&gt; InsertMode
</span><a href="System.Console.Haskeline.Command.History.html#foundHistory"><span class="hs-identifier hs-var hs-var">foundHistory</span></a></span><span>
</span><span id="line-97"></span><span>
</span><span id="line-98"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="System.Console.Haskeline.LineState.html#Result"><span class="hs-identifier hs-type">Result</span></a></span><span> </span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#SearchMode"><span class="hs-identifier hs-type">SearchMode</span></a></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-99"></span><span>    </span><span id="local-6989586621679094166"><span class="annot"><span class="annottext">toResult :: SearchMode -&gt; String
</span><a href="System.Console.Haskeline.LineState.html#toResult"><span class="hs-identifier hs-var hs-var hs-var hs-var">toResult</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InsertMode -&gt; String
forall s. Result s =&gt; s -&gt; String
</span><a href="System.Console.Haskeline.LineState.html#toResult"><span class="hs-identifier hs-var">toResult</span></a></span><span> </span><span class="annot"><span class="annottext">(InsertMode -&gt; String)
-&gt; (SearchMode -&gt; InsertMode) -&gt; SearchMode -&gt; String
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">SearchMode -&gt; InsertMode
</span><a href="System.Console.Haskeline.Command.History.html#foundHistory"><span class="hs-identifier hs-var hs-var">foundHistory</span></a></span><span>
</span><span id="line-100"></span><span>
</span><span id="line-101"></span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#saveSM"><span class="hs-identifier hs-type">saveSM</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#SearchMode"><span class="hs-identifier hs-type">SearchMode</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="System.Console.Haskeline.LineState.html#Grapheme"><span class="hs-identifier hs-type">Grapheme</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-102"></span><span id="saveSM"><span class="annot"><span class="annottext">saveSM :: SearchMode -&gt; [Grapheme]
</span><a href="System.Console.Haskeline.Command.History.html#saveSM"><span class="hs-identifier hs-var hs-var">saveSM</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InsertMode -&gt; [Grapheme]
forall s. Save s =&gt; s -&gt; [Grapheme]
</span><a href="System.Console.Haskeline.LineState.html#listSave"><span class="hs-identifier hs-var">listSave</span></a></span><span> </span><span class="annot"><span class="annottext">(InsertMode -&gt; [Grapheme])
-&gt; (SearchMode -&gt; InsertMode) -&gt; SearchMode -&gt; [Grapheme]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">SearchMode -&gt; InsertMode
</span><a href="System.Console.Haskeline.Command.History.html#foundHistory"><span class="hs-identifier hs-var hs-var">foundHistory</span></a></span><span>
</span><span id="line-103"></span><span>
</span><span id="line-104"></span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#startSearchMode"><span class="hs-identifier hs-type">startSearchMode</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#Direction"><span class="hs-identifier hs-type">Direction</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="System.Console.Haskeline.LineState.html#InsertMode"><span class="hs-identifier hs-type">InsertMode</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#SearchMode"><span class="hs-identifier hs-type">SearchMode</span></a></span><span>
</span><span id="line-105"></span><span id="startSearchMode"><span class="annot"><span class="annottext">startSearchMode :: Direction -&gt; InsertMode -&gt; SearchMode
</span><a href="System.Console.Haskeline.Command.History.html#startSearchMode"><span class="hs-identifier hs-var hs-var">startSearchMode</span></a></span></span><span> </span><span id="local-6989586621679094162"><span class="annot"><span class="annottext">Direction
</span><a href="#local-6989586621679094162"><span class="hs-identifier hs-var">dir</span></a></span></span><span> </span><span id="local-6989586621679094161"><span class="annot"><span class="annottext">InsertMode
</span><a href="#local-6989586621679094161"><span class="hs-identifier hs-var">im</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SearchMode :: [Grapheme] -&gt; InsertMode -&gt; Direction -&gt; SearchMode
</span><a href="System.Console.Haskeline.Command.History.html#SearchMode"><span class="hs-identifier hs-type">SearchMode</span></a></span><span> </span><span class="hs-special">{</span><span class="annot"><span class="annottext">searchTerm :: [Grapheme]
</span><a href="System.Console.Haskeline.Command.History.html#searchTerm"><span class="hs-identifier hs-var">searchTerm</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span class="annot"><span class="annottext">foundHistory :: InsertMode
</span><a href="System.Console.Haskeline.Command.History.html#foundHistory"><span class="hs-identifier hs-var">foundHistory</span></a></span><span class="hs-glyph">=</span><span class="annot"><span class="annottext">InsertMode
</span><a href="#local-6989586621679094161"><span class="hs-identifier hs-var">im</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">direction :: Direction
</span><a href="System.Console.Haskeline.Command.History.html#direction"><span class="hs-identifier hs-var">direction</span></a></span><span class="hs-glyph">=</span><span class="annot"><span class="annottext">Direction
</span><a href="#local-6989586621679094162"><span class="hs-identifier hs-var">dir</span></a></span><span class="hs-special">}</span><span>
</span><span id="line-106"></span><span>
</span><span id="line-107"></span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#addChar"><span class="hs-identifier hs-type">addChar</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Char</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#SearchMode"><span class="hs-identifier hs-type">SearchMode</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#SearchMode"><span class="hs-identifier hs-type">SearchMode</span></a></span><span>
</span><span id="line-108"></span><span id="addChar"><span class="annot"><span class="annottext">addChar :: Char -&gt; SearchMode -&gt; SearchMode
</span><a href="System.Console.Haskeline.Command.History.html#addChar"><span class="hs-identifier hs-var hs-var">addChar</span></a></span></span><span> </span><span id="local-6989586621679094159"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679094159"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679094158"><span class="annot"><span class="annottext">SearchMode
</span><a href="#local-6989586621679094158"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SearchMode
</span><a href="#local-6989586621679094158"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="hs-special">{</span><span class="annot"><span class="annottext">searchTerm :: [Grapheme]
</span><a href="System.Console.Haskeline.Command.History.html#searchTerm"><span class="hs-identifier hs-var">searchTerm</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InsertMode -&gt; [Grapheme]
forall s. Save s =&gt; s -&gt; [Grapheme]
</span><a href="System.Console.Haskeline.LineState.html#listSave"><span class="hs-identifier hs-var">listSave</span></a></span><span> </span><span class="annot"><span class="annottext">(InsertMode -&gt; [Grapheme]) -&gt; InsertMode -&gt; [Grapheme]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; InsertMode -&gt; InsertMode
</span><a href="System.Console.Haskeline.LineState.html#insertChar"><span class="hs-identifier hs-var">insertChar</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679094159"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span>
</span><span id="line-109"></span><span>                                </span><span class="annot"><span class="annottext">(InsertMode -&gt; InsertMode) -&gt; InsertMode -&gt; InsertMode
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[Grapheme] -&gt; InsertMode
forall s. Save s =&gt; [Grapheme] -&gt; s
</span><a href="System.Console.Haskeline.LineState.html#listRestore"><span class="hs-identifier hs-var">listRestore</span></a></span><span> </span><span class="annot"><span class="annottext">([Grapheme] -&gt; InsertMode) -&gt; [Grapheme] -&gt; InsertMode
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">SearchMode -&gt; [Grapheme]
</span><a href="System.Console.Haskeline.Command.History.html#searchTerm"><span class="hs-identifier hs-var hs-var">searchTerm</span></a></span><span> </span><span class="annot"><span class="annottext">SearchMode
</span><a href="#local-6989586621679094158"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">}</span><span>
</span><span id="line-110"></span><span>
</span><span id="line-111"></span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#searchHistories"><span class="hs-identifier hs-type">searchHistories</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#Direction"><span class="hs-identifier hs-type">Direction</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="System.Console.Haskeline.LineState.html#Grapheme"><span class="hs-identifier hs-type">Grapheme</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="System.Console.Haskeline.LineState.html#Grapheme"><span class="hs-identifier hs-type">Grapheme</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#HistLog"><span class="hs-identifier hs-type">HistLog</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-112"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#SearchMode"><span class="hs-identifier hs-type">SearchMode</span></a></span><span class="hs-special">,</span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#HistLog"><span class="hs-identifier hs-type">HistLog</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-113"></span><span id="searchHistories"><span class="annot"><span class="annottext">searchHistories :: Direction
-&gt; [Grapheme]
-&gt; [([Grapheme], HistLog)]
-&gt; Maybe (SearchMode, HistLog)
</span><a href="System.Console.Haskeline.Command.History.html#searchHistories"><span class="hs-identifier hs-var hs-var">searchHistories</span></a></span></span><span> </span><span id="local-6989586621679094155"><span class="annot"><span class="annottext">Direction
</span><a href="#local-6989586621679094155"><span class="hs-identifier hs-var">dir</span></a></span></span><span> </span><span id="local-6989586621679094154"><span class="annot"><span class="annottext">[Grapheme]
</span><a href="#local-6989586621679094154"><span class="hs-identifier hs-var">text</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Maybe (SearchMode, HistLog)
 -&gt; Maybe (SearchMode, HistLog) -&gt; Maybe (SearchMode, HistLog))
-&gt; Maybe (SearchMode, HistLog)
-&gt; [Maybe (SearchMode, HistLog)]
-&gt; Maybe (SearchMode, HistLog)
forall (t :: * -&gt; *) a b.
Foldable t =&gt;
(a -&gt; b -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe (SearchMode, HistLog)
-&gt; Maybe (SearchMode, HistLog) -&gt; Maybe (SearchMode, HistLog)
forall (m :: * -&gt; *) a. MonadPlus m =&gt; m a -&gt; m a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#mplus"><span class="hs-identifier hs-var">mplus</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe (SearchMode, HistLog)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="annot"><span class="annottext">([Maybe (SearchMode, HistLog)] -&gt; Maybe (SearchMode, HistLog))
-&gt; ([([Grapheme], HistLog)] -&gt; [Maybe (SearchMode, HistLog)])
-&gt; [([Grapheme], HistLog)]
-&gt; Maybe (SearchMode, HistLog)
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">(([Grapheme], HistLog) -&gt; Maybe (SearchMode, HistLog))
-&gt; [([Grapheme], HistLog)] -&gt; [Maybe (SearchMode, HistLog)]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">([Grapheme], HistLog) -&gt; Maybe (SearchMode, HistLog)
forall {b}. ([Grapheme], b) -&gt; Maybe (SearchMode, b)
</span><a href="#local-6989586621679094152"><span class="hs-identifier hs-var">findIt</span></a></span><span>
</span><span id="line-114"></span><span>    </span><span class="hs-keyword">where</span><span>
</span><span id="line-115"></span><span>        </span><span id="local-6989586621679094152"><span class="annot"><span class="annottext">findIt :: ([Grapheme], b) -&gt; Maybe (SearchMode, b)
</span><a href="#local-6989586621679094152"><span class="hs-identifier hs-var hs-var">findIt</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679094148"><span class="annot"><span class="annottext">[Grapheme]
</span><a href="#local-6989586621679094148"><span class="hs-identifier hs-var">l</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679094147"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679094147"><span class="hs-identifier hs-var">h</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span>
</span><span id="line-116"></span><span>            </span><span id="local-6989586621679094146"><span class="annot"><span class="annottext">InsertMode
</span><a href="#local-6989586621679094146"><span class="hs-identifier hs-var">im</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[Grapheme] -&gt; [Grapheme] -&gt; Maybe InsertMode
</span><a href="System.Console.Haskeline.Command.History.html#findInLine"><span class="hs-identifier hs-var">findInLine</span></a></span><span> </span><span class="annot"><span class="annottext">[Grapheme]
</span><a href="#local-6989586621679094154"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">[Grapheme]
</span><a href="#local-6989586621679094148"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-117"></span><span>            </span><span class="annot"><span class="annottext">(SearchMode, b) -&gt; Maybe (SearchMode, b)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Grapheme] -&gt; InsertMode -&gt; Direction -&gt; SearchMode
</span><a href="System.Console.Haskeline.Command.History.html#SearchMode"><span class="hs-identifier hs-var">SearchMode</span></a></span><span> </span><span class="annot"><span class="annottext">[Grapheme]
</span><a href="#local-6989586621679094154"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">InsertMode
</span><a href="#local-6989586621679094146"><span class="hs-identifier hs-var">im</span></a></span><span> </span><span class="annot"><span class="annottext">Direction
</span><a href="#local-6989586621679094155"><span class="hs-identifier hs-var">dir</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679094147"><span class="hs-identifier hs-var">h</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-118"></span><span>
</span><span id="line-119"></span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#findInLine"><span class="hs-identifier hs-type">findInLine</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="System.Console.Haskeline.LineState.html#Grapheme"><span class="hs-identifier hs-type">Grapheme</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="System.Console.Haskeline.LineState.html#Grapheme"><span class="hs-identifier hs-type">Grapheme</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="System.Console.Haskeline.LineState.html#InsertMode"><span class="hs-identifier hs-type">InsertMode</span></a></span><span>
</span><span id="line-120"></span><span id="findInLine"><span class="annot"><span class="annottext">findInLine :: [Grapheme] -&gt; [Grapheme] -&gt; Maybe InsertMode
</span><a href="System.Console.Haskeline.Command.History.html#findInLine"><span class="hs-identifier hs-var hs-var">findInLine</span></a></span></span><span> </span><span id="local-6989586621679094144"><span class="annot"><span class="annottext">[Grapheme]
</span><a href="#local-6989586621679094144"><span class="hs-identifier hs-var">text</span></a></span></span><span> </span><span id="local-6989586621679094143"><span class="annot"><span class="annottext">[Grapheme]
</span><a href="#local-6989586621679094143"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Grapheme] -&gt; [Grapheme] -&gt; Maybe InsertMode
</span><a href="#local-6989586621679094142"><span class="hs-identifier hs-var">find'</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">[Grapheme]
</span><a href="#local-6989586621679094143"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-121"></span><span>    </span><span class="hs-keyword">where</span><span>
</span><span id="line-122"></span><span>        </span><span id="local-6989586621679094142"><span class="annot"><span class="annottext">find' :: [Grapheme] -&gt; [Grapheme] -&gt; Maybe InsertMode
</span><a href="#local-6989586621679094142"><span class="hs-identifier hs-var hs-var">find'</span></a></span></span><span> </span><span class="annot"><span class="annottext">[Grapheme]
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe InsertMode
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-123"></span><span>        </span><span class="annot"><a href="#local-6989586621679094142"><span class="hs-identifier hs-var">find'</span></a></span><span> </span><span id="local-6989586621679094139"><span class="annot"><span class="annottext">[Grapheme]
</span><a href="#local-6989586621679094139"><span class="hs-identifier hs-var">prev</span></a></span></span><span> </span><span id="local-6989586621679094138"><span class="annot"><span class="annottext">ccs :: [Grapheme]
</span><a href="#local-6989586621679094138"><span class="hs-identifier hs-var">ccs</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span id="local-6989586621679094137"><span class="annot"><span class="annottext">Grapheme
</span><a href="#local-6989586621679094137"><span class="hs-identifier hs-var">c</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621679094136"><span class="annot"><span class="annottext">[Grapheme]
</span><a href="#local-6989586621679094136"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-124"></span><span>            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">[Grapheme]
</span><a href="#local-6989586621679094144"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">[Grapheme] -&gt; [Grapheme] -&gt; Bool
forall a. Eq a =&gt; [a] -&gt; [a] -&gt; Bool
</span><a href="../../base/src/Data.OldList.html#isPrefixOf"><span class="hs-operator hs-var">`isPrefixOf`</span></a></span><span> </span><span class="annot"><span class="annottext">[Grapheme]
</span><a href="#local-6989586621679094138"><span class="hs-identifier hs-var">ccs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InsertMode -&gt; Maybe InsertMode
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Grapheme] -&gt; [Grapheme] -&gt; InsertMode
</span><a href="System.Console.Haskeline.LineState.html#IMode"><span class="hs-identifier hs-var">IMode</span></a></span><span> </span><span class="annot"><span class="annottext">[Grapheme]
</span><a href="#local-6989586621679094139"><span class="hs-identifier hs-var">prev</span></a></span><span> </span><span class="annot"><span class="annottext">[Grapheme]
</span><a href="#local-6989586621679094138"><span class="hs-identifier hs-var">ccs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-125"></span><span>            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Grapheme] -&gt; [Grapheme] -&gt; Maybe InsertMode
</span><a href="#local-6989586621679094142"><span class="hs-identifier hs-var">find'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Grapheme
</span><a href="#local-6989586621679094137"><span class="hs-identifier hs-var">c</span></a></span><span class="annot"><span class="annottext">Grapheme -&gt; [Grapheme] -&gt; [Grapheme]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[Grapheme]
</span><a href="#local-6989586621679094139"><span class="hs-identifier hs-var">prev</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Grapheme]
</span><a href="#local-6989586621679094136"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-126"></span><span>
</span><span id="line-127"></span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#prepSearch"><span class="hs-identifier hs-type">prepSearch</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#SearchMode"><span class="hs-identifier hs-type">SearchMode</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#HistLog"><span class="hs-identifier hs-type">HistLog</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="System.Console.Haskeline.LineState.html#Grapheme"><span class="hs-identifier hs-type">Grapheme</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span class="hs-special">[</span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="System.Console.Haskeline.LineState.html#Grapheme"><span class="hs-identifier hs-type">Grapheme</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#HistLog"><span class="hs-identifier hs-type">HistLog</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-128"></span><span id="prepSearch"><span class="annot"><span class="annottext">prepSearch :: SearchMode -&gt; HistLog -&gt; ([Grapheme], [([Grapheme], HistLog)])
</span><a href="System.Console.Haskeline.Command.History.html#prepSearch"><span class="hs-identifier hs-var hs-var">prepSearch</span></a></span></span><span> </span><span id="local-6989586621679094133"><span class="annot"><span class="annottext">SearchMode
</span><a href="#local-6989586621679094133"><span class="hs-identifier hs-var">sm</span></a></span></span><span> </span><span id="local-6989586621679094132"><span class="annot"><span class="annottext">HistLog
</span><a href="#local-6989586621679094132"><span class="hs-identifier hs-var">h</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span>
</span><span id="line-129"></span><span>    </span><span id="local-6989586621679094131"><span class="annot"><span class="annottext">text :: [Grapheme]
</span><a href="#local-6989586621679094131"><span class="hs-identifier hs-var hs-var">text</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SearchMode -&gt; [Grapheme]
</span><a href="System.Console.Haskeline.Command.History.html#searchTerm"><span class="hs-identifier hs-var hs-var">searchTerm</span></a></span><span> </span><span class="annot"><span class="annottext">SearchMode
</span><a href="#local-6989586621679094133"><span class="hs-identifier hs-var">sm</span></a></span><span>
</span><span id="line-130"></span><span>    </span><span id="local-6989586621679094130"><span class="annot"><span class="annottext">l :: [Grapheme]
</span><a href="#local-6989586621679094130"><span class="hs-identifier hs-var hs-var">l</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SearchMode -&gt; [Grapheme]
</span><a href="System.Console.Haskeline.Command.History.html#saveSM"><span class="hs-identifier hs-var">saveSM</span></a></span><span> </span><span class="annot"><span class="annottext">SearchMode
</span><a href="#local-6989586621679094133"><span class="hs-identifier hs-var">sm</span></a></span><span>
</span><span id="line-131"></span><span>    </span><span class="hs-keyword">in</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Grapheme]
</span><a href="#local-6989586621679094131"><span class="hs-identifier hs-var">text</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">[Grapheme] -&gt; HistLog -&gt; [([Grapheme], HistLog)]
</span><a href="System.Console.Haskeline.Command.History.html#prevHistories"><span class="hs-identifier hs-var">prevHistories</span></a></span><span> </span><span class="annot"><span class="annottext">[Grapheme]
</span><a href="#local-6989586621679094130"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">HistLog
</span><a href="#local-6989586621679094132"><span class="hs-identifier hs-var">h</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-132"></span><span>
</span><span id="line-133"></span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#searchBackwards"><span class="hs-identifier hs-type">searchBackwards</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#SearchMode"><span class="hs-identifier hs-type">SearchMode</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#HistLog"><span class="hs-identifier hs-type">HistLog</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#SearchMode"><span class="hs-identifier hs-type">SearchMode</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#HistLog"><span class="hs-identifier hs-type">HistLog</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-134"></span><span id="searchBackwards"><span class="annot"><span class="annottext">searchBackwards :: Bool -&gt; SearchMode -&gt; HistLog -&gt; Maybe (SearchMode, HistLog)
</span><a href="System.Console.Haskeline.Command.History.html#searchBackwards"><span class="hs-identifier hs-var hs-var">searchBackwards</span></a></span></span><span> </span><span id="local-6989586621679094128"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679094128"><span class="hs-identifier hs-var">useCurrent</span></a></span></span><span> </span><span id="local-6989586621679094127"><span class="annot"><span class="annottext">SearchMode
</span><a href="#local-6989586621679094127"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span id="local-6989586621679094126"><span class="annot"><span class="annottext">HistLog
</span><a href="#local-6989586621679094126"><span class="hs-identifier hs-var">h</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span>
</span><span id="line-135"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621679094125"><span class="annot"><span class="annottext">[Grapheme]
</span><a href="#local-6989586621679094125"><span class="hs-identifier hs-var">text</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679094124"><span class="annot"><span class="annottext">[([Grapheme], HistLog)]
</span><a href="#local-6989586621679094124"><span class="hs-identifier hs-var">hists</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SearchMode -&gt; HistLog -&gt; ([Grapheme], [([Grapheme], HistLog)])
</span><a href="System.Console.Haskeline.Command.History.html#prepSearch"><span class="hs-identifier hs-var">prepSearch</span></a></span><span> </span><span class="annot"><span class="annottext">SearchMode
</span><a href="#local-6989586621679094127"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">HistLog
</span><a href="#local-6989586621679094126"><span class="hs-identifier hs-var">h</span></a></span><span>
</span><span id="line-136"></span><span>    </span><span id="local-6989586621679094123"><span class="annot"><span class="annottext">hists' :: [([Grapheme], HistLog)]
</span><a href="#local-6989586621679094123"><span class="hs-identifier hs-var hs-var">hists'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679094128"><span class="hs-identifier hs-var">useCurrent</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SearchMode -&gt; [Grapheme]
</span><a href="System.Console.Haskeline.Command.History.html#saveSM"><span class="hs-identifier hs-var">saveSM</span></a></span><span> </span><span class="annot"><span class="annottext">SearchMode
</span><a href="#local-6989586621679094127"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">HistLog
</span><a href="#local-6989586621679094126"><span class="hs-identifier hs-var">h</span></a></span><span class="hs-special">)</span><span class="annot"><span class="annottext">([Grapheme], HistLog)
-&gt; [([Grapheme], HistLog)] -&gt; [([Grapheme], HistLog)]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[([Grapheme], HistLog)]
</span><a href="#local-6989586621679094124"><span class="hs-identifier hs-var">hists</span></a></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">[([Grapheme], HistLog)]
</span><a href="#local-6989586621679094124"><span class="hs-identifier hs-var">hists</span></a></span><span>
</span><span id="line-137"></span><span>    </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">Direction
-&gt; [Grapheme]
-&gt; [([Grapheme], HistLog)]
-&gt; Maybe (SearchMode, HistLog)
</span><a href="System.Console.Haskeline.Command.History.html#searchHistories"><span class="hs-identifier hs-var">searchHistories</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SearchMode -&gt; Direction
</span><a href="System.Console.Haskeline.Command.History.html#direction"><span class="hs-identifier hs-var hs-var">direction</span></a></span><span> </span><span class="annot"><span class="annottext">SearchMode
</span><a href="#local-6989586621679094127"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Grapheme]
</span><a href="#local-6989586621679094125"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">[([Grapheme], HistLog)]
</span><a href="#local-6989586621679094123"><span class="hs-identifier hs-var">hists'</span></a></span><span>
</span><span id="line-138"></span><span>
</span><span id="line-139"></span><span id="local-6989586621679094447"><span class="annot"><a href="System.Console.Haskeline.Command.History.html#doSearch"><span class="hs-identifier hs-type">doSearch</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Monads.html#MonadState"><span class="hs-identifier hs-type">MonadState</span></a></span><span> </span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#HistLog"><span class="hs-identifier hs-type">HistLog</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679094447"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#SearchMode"><span class="hs-identifier hs-type">SearchMode</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679094447"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Either.html#Either"><span class="hs-identifier hs-type">Either</span></a></span><span> </span><span class="annot"><a href="System.Console.Haskeline.Command.html#Effect"><span class="hs-identifier hs-type">Effect</span></a></span><span> </span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#SearchMode"><span class="hs-identifier hs-type">SearchMode</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-140"></span><span id="doSearch"><span class="annot"><span class="annottext">doSearch :: forall (m :: * -&gt; *).
MonadState HistLog m =&gt;
Bool -&gt; SearchMode -&gt; m (Either Effect SearchMode)
</span><a href="System.Console.Haskeline.Command.History.html#doSearch"><span class="hs-identifier hs-var hs-var">doSearch</span></a></span></span><span> </span><span id="local-6989586621679094118"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679094118"><span class="hs-identifier hs-var">useCurrent</span></a></span></span><span> </span><span id="local-6989586621679094117"><span class="annot"><span class="annottext">SearchMode
</span><a href="#local-6989586621679094117"><span class="hs-identifier hs-var">sm</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">SearchMode -&gt; Direction
</span><a href="System.Console.Haskeline.Command.History.html#direction"><span class="hs-identifier hs-var hs-var">direction</span></a></span><span> </span><span class="annot"><span class="annottext">SearchMode
</span><a href="#local-6989586621679094117"><span class="hs-identifier hs-var">sm</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-141"></span><span>    </span><span class="annot"><span class="annottext">Direction
</span><a href="System.Console.Haskeline.Command.History.html#Reverse"><span class="hs-identifier hs-var">Reverse</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">m (Either Effect SearchMode)
</span><a href="#local-6989586621679094116"><span class="hs-identifier hs-var">searchHist</span></a></span><span>
</span><span id="line-142"></span><span>    </span><span class="annot"><span class="annottext">Direction
</span><a href="System.Console.Haskeline.Command.History.html#Forward"><span class="hs-identifier hs-var">Forward</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">m (Either Effect SearchMode) -&gt; m (Either Effect SearchMode)
forall (m :: * -&gt; *) b. MonadState HistLog m =&gt; m b -&gt; m b
</span><a href="System.Console.Haskeline.Command.History.html#reverseHist"><span class="hs-identifier hs-var">reverseHist</span></a></span><span> </span><span class="annot"><span class="annottext">m (Either Effect SearchMode)
</span><a href="#local-6989586621679094116"><span class="hs-identifier hs-var">searchHist</span></a></span><span>
</span><span id="line-143"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-144"></span><span>    </span><span id="local-6989586621679094116"><span class="annot"><span class="annottext">searchHist :: m (Either Effect SearchMode)
</span><a href="#local-6989586621679094116"><span class="hs-identifier hs-var hs-var">searchHist</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-145"></span><span>        </span><span id="local-6989586621679094109"><span class="annot"><span class="annottext">HistLog
</span><a href="#local-6989586621679094109"><span class="hs-identifier hs-var">hist</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">m HistLog
forall s (m :: * -&gt; *). MonadState s m =&gt; m s
</span><a href="System.Console.Haskeline.Monads.html#get"><span class="hs-identifier hs-var">get</span></a></span><span>
</span><span id="line-146"></span><span>        </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; SearchMode -&gt; HistLog -&gt; Maybe (SearchMode, HistLog)
</span><a href="System.Console.Haskeline.Command.History.html#searchBackwards"><span class="hs-identifier hs-var">searchBackwards</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679094118"><span class="hs-identifier hs-var">useCurrent</span></a></span><span> </span><span class="annot"><span class="annottext">SearchMode
</span><a href="#local-6989586621679094117"><span class="hs-identifier hs-var">sm</span></a></span><span> </span><span class="annot"><span class="annottext">HistLog
</span><a href="#local-6989586621679094109"><span class="hs-identifier hs-var">hist</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-147"></span><span>            </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679094107"><span class="annot"><span class="annottext">SearchMode
</span><a href="#local-6989586621679094107"><span class="hs-identifier hs-var">sm'</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679094106"><span class="annot"><span class="annottext">HistLog
</span><a href="#local-6989586621679094106"><span class="hs-identifier hs-var">hist'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">HistLog -&gt; m ()
forall s (m :: * -&gt; *). MonadState s m =&gt; s -&gt; m ()
</span><a href="System.Console.Haskeline.Monads.html#put"><span class="hs-identifier hs-var">put</span></a></span><span> </span><span class="annot"><span class="annottext">HistLog
</span><a href="#local-6989586621679094106"><span class="hs-identifier hs-var">hist'</span></a></span><span> </span><span class="annot"><span class="annottext">m ()
-&gt; m (Either Effect SearchMode) -&gt; m (Either Effect SearchMode)
forall (m :: * -&gt; *) a b. Monad m =&gt; m a -&gt; m b -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3E%3E"><span class="hs-operator hs-var">&gt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Either Effect SearchMode -&gt; m (Either Effect SearchMode)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SearchMode -&gt; Either Effect SearchMode
forall a b. b -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Right"><span class="hs-identifier hs-var">Right</span></a></span><span> </span><span class="annot"><span class="annottext">SearchMode
</span><a href="#local-6989586621679094107"><span class="hs-identifier hs-var">sm'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-148"></span><span>            </span><span class="annot"><span class="annottext">Maybe (SearchMode, HistLog)
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Either Effect SearchMode -&gt; m (Either Effect SearchMode)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(Either Effect SearchMode -&gt; m (Either Effect SearchMode))
-&gt; Either Effect SearchMode -&gt; m (Either Effect SearchMode)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Effect -&gt; Either Effect SearchMode
forall a b. a -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Left"><span class="hs-identifier hs-var">Left</span></a></span><span> </span><span class="annot"><span class="annottext">Effect
</span><a href="System.Console.Haskeline.Command.html#RingBell"><span class="hs-identifier hs-var">RingBell</span></a></span><span>
</span><span id="line-149"></span><span>
</span><span id="line-150"></span><span id="local-6989586621679094443"><span class="annot"><a href="System.Console.Haskeline.Command.History.html#searchHistory"><span class="hs-identifier hs-type">searchHistory</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Monads.html#MonadState"><span class="hs-identifier hs-type">MonadState</span></a></span><span> </span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#HistLog"><span class="hs-identifier hs-type">HistLog</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679094443"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Command.html#KeyCommand"><span class="hs-identifier hs-type">KeyCommand</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679094443"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="System.Console.Haskeline.LineState.html#InsertMode"><span class="hs-identifier hs-type">InsertMode</span></a></span><span> </span><span class="annot"><a href="System.Console.Haskeline.LineState.html#InsertMode"><span class="hs-identifier hs-type">InsertMode</span></a></span></span><span>
</span><span id="line-151"></span><span id="searchHistory"><span class="annot"><span class="annottext">searchHistory :: forall (m :: * -&gt; *).
MonadState HistLog m =&gt;
KeyCommand m InsertMode InsertMode
</span><a href="System.Console.Haskeline.Command.History.html#searchHistory"><span class="hs-identifier hs-var hs-var">searchHistory</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[KeyMap (Command m InsertMode InsertMode)]
-&gt; KeyMap (Command m InsertMode InsertMode)
forall a. [KeyMap a] -&gt; KeyMap a
</span><a href="System.Console.Haskeline.Command.html#choiceCmd"><span class="hs-identifier hs-var">choiceCmd</span></a></span><span> </span><span class="hs-special">[</span><span>
</span><span id="line-152"></span><span>            </span><span class="annot"><span class="annottext">Char -&gt; Key
</span><a href="System.Console.Haskeline.Key.html#metaChar"><span class="hs-identifier hs-var">metaChar</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'j'</span></span><span> </span><span class="annot"><span class="annottext">Key
-&gt; Command m InsertMode InsertMode
-&gt; KeyMap (Command m InsertMode InsertMode)
forall a. Key -&gt; a -&gt; KeyMap a
</span><a href="System.Console.Haskeline.Command.html#%2B%3E"><span class="hs-operator hs-var">+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Direction -&gt; Command m InsertMode InsertMode
forall (m :: * -&gt; *).
MonadState HistLog m =&gt;
Direction -&gt; Command m InsertMode InsertMode
</span><a href="System.Console.Haskeline.Command.History.html#searchForPrefix"><span class="hs-identifier hs-var">searchForPrefix</span></a></span><span> </span><span class="annot"><span class="annottext">Direction
</span><a href="System.Console.Haskeline.Command.History.html#Forward"><span class="hs-identifier hs-var">Forward</span></a></span><span>
</span><span id="line-153"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Key
</span><a href="System.Console.Haskeline.Key.html#metaChar"><span class="hs-identifier hs-var">metaChar</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'k'</span></span><span> </span><span class="annot"><span class="annottext">Key
-&gt; Command m InsertMode InsertMode
-&gt; KeyMap (Command m InsertMode InsertMode)
forall a. Key -&gt; a -&gt; KeyMap a
</span><a href="System.Console.Haskeline.Command.html#%2B%3E"><span class="hs-operator hs-var">+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Direction -&gt; Command m InsertMode InsertMode
forall (m :: * -&gt; *).
MonadState HistLog m =&gt;
Direction -&gt; Command m InsertMode InsertMode
</span><a href="System.Console.Haskeline.Command.History.html#searchForPrefix"><span class="hs-identifier hs-var">searchForPrefix</span></a></span><span> </span><span class="annot"><span class="annottext">Direction
</span><a href="System.Console.Haskeline.Command.History.html#Reverse"><span class="hs-identifier hs-var">Reverse</span></a></span><span>
</span><span id="line-154"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[KeyMap (Command m InsertMode SearchMode)]
-&gt; KeyMap (Command m InsertMode SearchMode)
forall a. [KeyMap a] -&gt; KeyMap a
</span><a href="System.Console.Haskeline.Command.html#choiceCmd"><span class="hs-identifier hs-var">choiceCmd</span></a></span><span> </span><span class="hs-special">[</span><span>
</span><span id="line-155"></span><span>                 </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679094089"><span class="hs-identifier hs-var">backKey</span></a></span><span> </span><span class="annot"><span class="annottext">Key
-&gt; Command m InsertMode SearchMode
-&gt; KeyMap (Command m InsertMode SearchMode)
forall a. Key -&gt; a -&gt; KeyMap a
</span><a href="System.Console.Haskeline.Command.html#%2B%3E"><span class="hs-operator hs-var">+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">(InsertMode -&gt; SearchMode) -&gt; Command m InsertMode SearchMode
forall t (m :: * -&gt; *) s.
(LineState t, Monad m) =&gt;
(s -&gt; t) -&gt; Command m s t
</span><a href="System.Console.Haskeline.Command.html#change"><span class="hs-identifier hs-var">change</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Direction -&gt; InsertMode -&gt; SearchMode
</span><a href="System.Console.Haskeline.Command.History.html#startSearchMode"><span class="hs-identifier hs-var">startSearchMode</span></a></span><span> </span><span class="annot"><span class="annottext">Direction
</span><a href="System.Console.Haskeline.Command.History.html#Reverse"><span class="hs-identifier hs-var">Reverse</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-156"></span><span>                 </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679094087"><span class="hs-identifier hs-var">forwardKey</span></a></span><span> </span><span class="annot"><span class="annottext">Key
-&gt; Command m InsertMode SearchMode
-&gt; KeyMap (Command m InsertMode SearchMode)
forall a. Key -&gt; a -&gt; KeyMap a
</span><a href="System.Console.Haskeline.Command.html#%2B%3E"><span class="hs-operator hs-var">+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">(InsertMode -&gt; SearchMode) -&gt; Command m InsertMode SearchMode
forall t (m :: * -&gt; *) s.
(LineState t, Monad m) =&gt;
(s -&gt; t) -&gt; Command m s t
</span><a href="System.Console.Haskeline.Command.html#change"><span class="hs-identifier hs-var">change</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Direction -&gt; InsertMode -&gt; SearchMode
</span><a href="System.Console.Haskeline.Command.History.html#startSearchMode"><span class="hs-identifier hs-var">startSearchMode</span></a></span><span> </span><span class="annot"><span class="annottext">Direction
</span><a href="System.Console.Haskeline.Command.History.html#Forward"><span class="hs-identifier hs-var">Forward</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-157"></span><span>                 </span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">KeyMap (Command m InsertMode SearchMode)
-&gt; Command m SearchMode InsertMode
-&gt; KeyMap (Command m InsertMode InsertMode)
forall (m :: * -&gt; *) s t u.
Monad m =&gt;
KeyCommand m s t -&gt; Command m t u -&gt; KeyCommand m s u
</span><a href="System.Console.Haskeline.Command.html#%3E%2B%3E"><span class="hs-operator hs-var">&gt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Command m SearchMode InsertMode
</span><a href="#local-6989586621679094085"><span class="hs-identifier hs-var">keepSearching</span></a></span><span>
</span><span id="line-158"></span><span>            </span><span class="hs-special">]</span><span>
</span><span id="line-159"></span><span>    </span><span class="hs-keyword">where</span><span>
</span><span id="line-160"></span><span>        </span><span id="local-6989586621679094089"><span class="annot"><span class="annottext">backKey :: Key
</span><a href="#local-6989586621679094089"><span class="hs-identifier hs-var hs-var">backKey</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Key
</span><a href="System.Console.Haskeline.Key.html#ctrlChar"><span class="hs-identifier hs-var">ctrlChar</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'r'</span></span><span>
</span><span id="line-161"></span><span>        </span><span id="local-6989586621679094087"><span class="annot"><span class="annottext">forwardKey :: Key
</span><a href="#local-6989586621679094087"><span class="hs-identifier hs-var hs-var">forwardKey</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Key
</span><a href="System.Console.Haskeline.Key.html#ctrlChar"><span class="hs-identifier hs-var">ctrlChar</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'s'</span></span><span>
</span><span id="line-162"></span><span>        </span><span id="local-6989586621679094085"><span class="annot"><span class="annottext">keepSearching :: Command m SearchMode InsertMode
</span><a href="#local-6989586621679094085"><span class="hs-identifier hs-var hs-var">keepSearching</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[KeyCommand m SearchMode InsertMode]
-&gt; Command m SearchMode InsertMode
forall (m :: * -&gt; *) s t. [KeyCommand m s t] -&gt; Command m s t
</span><a href="System.Console.Haskeline.Command.html#keyChoiceCmd"><span class="hs-identifier hs-var">keyChoiceCmd</span></a></span><span> </span><span class="hs-special">[</span><span>
</span><span id="line-163"></span><span>                            </span><span class="annot"><span class="annottext">[KeyMap (Command m SearchMode SearchMode)]
-&gt; KeyMap (Command m SearchMode SearchMode)
forall a. [KeyMap a] -&gt; KeyMap a
</span><a href="System.Console.Haskeline.Command.html#choiceCmd"><span class="hs-identifier hs-var">choiceCmd</span></a></span><span> </span><span class="hs-special">[</span><span>
</span><span id="line-164"></span><span>                                </span><span class="annot"><span class="annottext">(Char -&gt; SearchMode -&gt; m (Either Effect SearchMode))
-&gt; KeyMap (Command m SearchMode SearchMode)
forall s (m :: * -&gt; *).
(LineState s, Monad m) =&gt;
(Char -&gt; s -&gt; m (Either Effect s)) -&gt; KeyCommand m s s
</span><a href="System.Console.Haskeline.Command.html#charCommand"><span class="hs-identifier hs-var">charCommand</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; SearchMode -&gt; m (Either Effect SearchMode)
forall {m :: * -&gt; *}.
MonadState HistLog m =&gt;
Char -&gt; SearchMode -&gt; m (Either Effect SearchMode)
</span><a href="#local-6989586621679094067"><span class="hs-identifier hs-var">oneMoreChar</span></a></span><span>
</span><span id="line-165"></span><span>                                </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679094089"><span class="hs-identifier hs-var">backKey</span></a></span><span> </span><span class="annot"><span class="annottext">Key
-&gt; Command m SearchMode SearchMode
-&gt; KeyMap (Command m SearchMode SearchMode)
forall a. Key -&gt; a -&gt; KeyMap a
</span><a href="System.Console.Haskeline.Command.html#%2B%3E"><span class="hs-operator hs-var">+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">(SearchMode -&gt; m (Either Effect SearchMode))
-&gt; Command m SearchMode SearchMode
forall s (m :: * -&gt; *).
(LineState s, Monad m) =&gt;
(s -&gt; m (Either Effect s)) -&gt; Command m s s
</span><a href="System.Console.Haskeline.Command.html#simpleCommand"><span class="hs-identifier hs-var">simpleCommand</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Direction -&gt; SearchMode -&gt; m (Either Effect SearchMode)
forall {m :: * -&gt; *}.
MonadState HistLog m =&gt;
Direction -&gt; SearchMode -&gt; m (Either Effect SearchMode)
</span><a href="#local-6989586621679094066"><span class="hs-identifier hs-var">searchMore</span></a></span><span> </span><span class="annot"><span class="annottext">Direction
</span><a href="System.Console.Haskeline.Command.History.html#Reverse"><span class="hs-identifier hs-var">Reverse</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-166"></span><span>                                </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679094087"><span class="hs-identifier hs-var">forwardKey</span></a></span><span> </span><span class="annot"><span class="annottext">Key
-&gt; Command m SearchMode SearchMode
-&gt; KeyMap (Command m SearchMode SearchMode)
forall a. Key -&gt; a -&gt; KeyMap a
</span><a href="System.Console.Haskeline.Command.html#%2B%3E"><span class="hs-operator hs-var">+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">(SearchMode -&gt; m (Either Effect SearchMode))
-&gt; Command m SearchMode SearchMode
forall s (m :: * -&gt; *).
(LineState s, Monad m) =&gt;
(s -&gt; m (Either Effect s)) -&gt; Command m s s
</span><a href="System.Console.Haskeline.Command.html#simpleCommand"><span class="hs-identifier hs-var">simpleCommand</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Direction -&gt; SearchMode -&gt; m (Either Effect SearchMode)
forall {m :: * -&gt; *}.
MonadState HistLog m =&gt;
Direction -&gt; SearchMode -&gt; m (Either Effect SearchMode)
</span><a href="#local-6989586621679094066"><span class="hs-identifier hs-var">searchMore</span></a></span><span> </span><span class="annot"><span class="annottext">Direction
</span><a href="System.Console.Haskeline.Command.History.html#Forward"><span class="hs-identifier hs-var">Forward</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-167"></span><span>                                </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">BaseKey -&gt; Key
</span><a href="System.Console.Haskeline.Key.html#simpleKey"><span class="hs-identifier hs-var">simpleKey</span></a></span><span> </span><span class="annot"><span class="annottext">BaseKey
</span><a href="System.Console.Haskeline.Key.html#Backspace"><span class="hs-identifier hs-var">Backspace</span></a></span><span> </span><span class="annot"><span class="annottext">Key
-&gt; Command m SearchMode SearchMode
-&gt; KeyMap (Command m SearchMode SearchMode)
forall a. Key -&gt; a -&gt; KeyMap a
</span><a href="System.Console.Haskeline.Command.html#%2B%3E"><span class="hs-operator hs-var">+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">(SearchMode -&gt; SearchMode) -&gt; Command m SearchMode SearchMode
forall t (m :: * -&gt; *) s.
(LineState t, Monad m) =&gt;
(s -&gt; t) -&gt; Command m s t
</span><a href="System.Console.Haskeline.Command.html#change"><span class="hs-identifier hs-var">change</span></a></span><span> </span><span class="annot"><span class="annottext">SearchMode -&gt; SearchMode
</span><a href="#local-6989586621679094063"><span class="hs-identifier hs-var">delLastChar</span></a></span><span>
</span><span id="line-168"></span><span>                                </span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">KeyMap (Command m SearchMode SearchMode)
-&gt; Command m SearchMode InsertMode
-&gt; KeyCommand m SearchMode InsertMode
forall (m :: * -&gt; *) s t u.
Monad m =&gt;
KeyCommand m s t -&gt; Command m t u -&gt; KeyCommand m s u
</span><a href="System.Console.Haskeline.Command.html#%3E%2B%3E"><span class="hs-operator hs-var">&gt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Command m SearchMode InsertMode
</span><a href="#local-6989586621679094085"><span class="hs-identifier hs-var">keepSearching</span></a></span><span>
</span><span id="line-169"></span><span>                            </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Command m SearchMode InsertMode
-&gt; KeyCommand m SearchMode InsertMode
forall (m :: * -&gt; *) s t. Command m s t -&gt; KeyCommand m s t
</span><a href="System.Console.Haskeline.Command.html#withoutConsuming"><span class="hs-identifier hs-var">withoutConsuming</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(SearchMode -&gt; InsertMode) -&gt; Command m SearchMode InsertMode
forall t (m :: * -&gt; *) s.
(LineState t, Monad m) =&gt;
(s -&gt; t) -&gt; Command m s t
</span><a href="System.Console.Haskeline.Command.html#change"><span class="hs-identifier hs-var">change</span></a></span><span> </span><span class="annot"><span class="annottext">SearchMode -&gt; InsertMode
</span><a href="System.Console.Haskeline.Command.History.html#foundHistory"><span class="hs-identifier hs-var hs-var">foundHistory</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- abort</span><span>
</span><span id="line-170"></span><span>                            </span><span class="hs-special">]</span><span>
</span><span id="line-171"></span><span>        </span><span id="local-6989586621679094063"><span class="annot"><span class="annottext">delLastChar :: SearchMode -&gt; SearchMode
</span><a href="#local-6989586621679094063"><span class="hs-identifier hs-var hs-var">delLastChar</span></a></span></span><span> </span><span id="local-6989586621679094061"><span class="annot"><span class="annottext">SearchMode
</span><a href="#local-6989586621679094061"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SearchMode
</span><a href="#local-6989586621679094061"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="hs-special">{</span><span class="annot"><span class="annottext">searchTerm :: [Grapheme]
</span><a href="System.Console.Haskeline.Command.History.html#searchTerm"><span class="hs-identifier hs-var">searchTerm</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Grapheme] -&gt; [Grapheme]
forall {a}. [a] -&gt; [a]
</span><a href="#local-6989586621679094060"><span class="hs-identifier hs-var">minit</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SearchMode -&gt; [Grapheme]
</span><a href="System.Console.Haskeline.Command.History.html#searchTerm"><span class="hs-identifier hs-var hs-var">searchTerm</span></a></span><span> </span><span class="annot"><span class="annottext">SearchMode
</span><a href="#local-6989586621679094061"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span class="hs-special">}</span><span>
</span><span id="line-172"></span><span>        </span><span id="local-6989586621679094060"><span class="annot"><span class="annottext">minit :: [a] -&gt; [a]
</span><a href="#local-6989586621679094060"><span class="hs-identifier hs-var hs-var">minit</span></a></span></span><span> </span><span id="local-6989586621679094058"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679094058"><span class="hs-identifier hs-var">xs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">[a] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679094058"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">[a] -&gt; [a]
forall {a}. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#init"><span class="hs-identifier hs-var">init</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679094058"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-173"></span><span>        </span><span id="local-6989586621679094067"><span class="annot"><span class="annottext">oneMoreChar :: Char -&gt; SearchMode -&gt; m (Either Effect SearchMode)
</span><a href="#local-6989586621679094067"><span class="hs-identifier hs-var hs-var">oneMoreChar</span></a></span></span><span> </span><span id="local-6989586621679094053"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679094053"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; SearchMode -&gt; m (Either Effect SearchMode)
forall (m :: * -&gt; *).
MonadState HistLog m =&gt;
Bool -&gt; SearchMode -&gt; m (Either Effect SearchMode)
</span><a href="System.Console.Haskeline.Command.History.html#doSearch"><span class="hs-identifier hs-var">doSearch</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span> </span><span class="annot"><span class="annottext">(SearchMode -&gt; m (Either Effect SearchMode))
-&gt; (SearchMode -&gt; SearchMode)
-&gt; SearchMode
-&gt; m (Either Effect SearchMode)
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; SearchMode -&gt; SearchMode
</span><a href="System.Console.Haskeline.Command.History.html#addChar"><span class="hs-identifier hs-var">addChar</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679094053"><span class="hs-identifier hs-var">c</span></a></span><span>
</span><span id="line-174"></span><span>        </span><span id="local-6989586621679094066"><span class="annot"><span class="annottext">searchMore :: Direction -&gt; SearchMode -&gt; m (Either Effect SearchMode)
</span><a href="#local-6989586621679094066"><span class="hs-identifier hs-var hs-var">searchMore</span></a></span></span><span> </span><span id="local-6989586621679094050"><span class="annot"><span class="annottext">Direction
</span><a href="#local-6989586621679094050"><span class="hs-identifier hs-var">d</span></a></span></span><span> </span><span id="local-6989586621679094049"><span class="annot"><span class="annottext">SearchMode
</span><a href="#local-6989586621679094049"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; SearchMode -&gt; m (Either Effect SearchMode)
forall (m :: * -&gt; *).
MonadState HistLog m =&gt;
Bool -&gt; SearchMode -&gt; m (Either Effect SearchMode)
</span><a href="System.Console.Haskeline.Command.History.html#doSearch"><span class="hs-identifier hs-var">doSearch</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">SearchMode
</span><a href="#local-6989586621679094049"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="hs-special">{</span><span class="annot"><span class="annottext">direction :: Direction
</span><a href="System.Console.Haskeline.Command.History.html#direction"><span class="hs-identifier hs-var">direction</span></a></span><span class="hs-glyph">=</span><span class="annot"><span class="annottext">Direction
</span><a href="#local-6989586621679094050"><span class="hs-identifier hs-var">d</span></a></span><span class="hs-special">}</span><span>
</span><span id="line-175"></span><span>
</span><span id="line-176"></span><span>
</span><span id="line-177"></span><span id="local-6989586621679094436"><span class="annot"><a href="System.Console.Haskeline.Command.History.html#searchForPrefix"><span class="hs-identifier hs-type">searchForPrefix</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Monads.html#MonadState"><span class="hs-identifier hs-type">MonadState</span></a></span><span> </span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#HistLog"><span class="hs-identifier hs-type">HistLog</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679094436"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#Direction"><span class="hs-identifier hs-type">Direction</span></a></span><span>
</span><span id="line-178"></span><span>                    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Command.html#Command"><span class="hs-identifier hs-type">Command</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679094436"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="System.Console.Haskeline.LineState.html#InsertMode"><span class="hs-identifier hs-type">InsertMode</span></a></span><span> </span><span class="annot"><a href="System.Console.Haskeline.LineState.html#InsertMode"><span class="hs-identifier hs-type">InsertMode</span></a></span></span><span>
</span><span id="line-179"></span><span id="searchForPrefix"><span class="annot"><span class="annottext">searchForPrefix :: forall (m :: * -&gt; *).
MonadState HistLog m =&gt;
Direction -&gt; Command m InsertMode InsertMode
</span><a href="System.Console.Haskeline.Command.History.html#searchForPrefix"><span class="hs-identifier hs-var hs-var">searchForPrefix</span></a></span></span><span> </span><span id="local-6989586621679094036"><span class="annot"><span class="annottext">Direction
</span><a href="#local-6989586621679094036"><span class="hs-identifier hs-var">dir</span></a></span></span><span> </span><span id="local-6989586621679094035"><span class="annot"><span class="annottext">s :: InsertMode
</span><a href="#local-6989586621679094035"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="System.Console.Haskeline.LineState.html#IMode"><span class="hs-identifier hs-type">IMode</span></a></span><span> </span><span id="local-6989586621679094034"><span class="annot"><span class="annottext">[Grapheme]
</span><a href="#local-6989586621679094034"><span class="hs-identifier hs-var">xs</span></a></span></span><span> </span><span class="annot"><span class="annottext">[Grapheme]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-180"></span><span>    </span><span id="local-6989586621679094033"><span class="annot"><span class="annottext">Maybe InsertMode
</span><a href="#local-6989586621679094033"><span class="hs-identifier hs-var">next</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">([Grapheme] -&gt; Maybe InsertMode)
-&gt; Direction -&gt; InsertMode -&gt; CmdM m (Maybe InsertMode)
forall s (m :: * -&gt; *).
(Save s, MonadState HistLog m) =&gt;
([Grapheme] -&gt; Maybe s) -&gt; Direction -&gt; s -&gt; m (Maybe s)
</span><a href="System.Console.Haskeline.Command.History.html#findFirst"><span class="hs-identifier hs-var">findFirst</span></a></span><span> </span><span class="annot"><span class="annottext">[Grapheme] -&gt; Maybe InsertMode
</span><a href="#local-6989586621679094031"><span class="hs-identifier hs-var">prefixed</span></a></span><span> </span><span class="annot"><span class="annottext">Direction
</span><a href="#local-6989586621679094036"><span class="hs-identifier hs-var">dir</span></a></span><span> </span><span class="annot"><span class="annottext">InsertMode
</span><a href="#local-6989586621679094035"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-181"></span><span>    </span><span class="annot"><span class="annottext">CmdM m InsertMode
-&gt; (InsertMode -&gt; CmdM m InsertMode)
-&gt; Maybe InsertMode
-&gt; CmdM m InsertMode
forall b a. b -&gt; (a -&gt; b) -&gt; Maybe a -&gt; b
</span><a href="../../base/src/Data.Maybe.html#maybe"><span class="hs-identifier hs-var">maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">InsertMode -&gt; CmdM m InsertMode
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">InsertMode
</span><a href="#local-6989586621679094035"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">InsertMode -&gt; CmdM m InsertMode
forall (m :: * -&gt; *) s. (Monad m, LineState s) =&gt; Command m s s
</span><a href="System.Console.Haskeline.Command.html#setState"><span class="hs-identifier hs-var">setState</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe InsertMode
</span><a href="#local-6989586621679094033"><span class="hs-identifier hs-var">next</span></a></span><span>
</span><span id="line-182"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-183"></span><span>    </span><span id="local-6989586621679094031"><span class="annot"><span class="annottext">prefixed :: [Grapheme] -&gt; Maybe InsertMode
</span><a href="#local-6989586621679094031"><span class="hs-identifier hs-var hs-var">prefixed</span></a></span></span><span> </span><span id="local-6989586621679094026"><span class="annot"><span class="annottext">[Grapheme]
</span><a href="#local-6989586621679094026"><span class="hs-identifier hs-var">gs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">[Grapheme]
</span><a href="#local-6989586621679094025"><span class="hs-identifier hs-var">rxs</span></a></span><span> </span><span class="annot"><span class="annottext">[Grapheme] -&gt; [Grapheme] -&gt; Bool
forall a. Eq a =&gt; [a] -&gt; [a] -&gt; Bool
</span><a href="../../base/src/Data.OldList.html#isPrefixOf"><span class="hs-operator hs-var">`isPrefixOf`</span></a></span><span> </span><span class="annot"><span class="annottext">[Grapheme]
</span><a href="#local-6989586621679094026"><span class="hs-identifier hs-var">gs</span></a></span><span>
</span><span id="line-184"></span><span>                    </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">InsertMode -&gt; Maybe InsertMode
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">(InsertMode -&gt; Maybe InsertMode) -&gt; InsertMode -&gt; Maybe InsertMode
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[Grapheme] -&gt; [Grapheme] -&gt; InsertMode
</span><a href="System.Console.Haskeline.LineState.html#IMode"><span class="hs-identifier hs-var">IMode</span></a></span><span> </span><span class="annot"><span class="annottext">[Grapheme]
</span><a href="#local-6989586621679094034"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; [Grapheme] -&gt; [Grapheme]
forall a. Int -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#drop"><span class="hs-identifier hs-var">drop</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Grapheme] -&gt; Int
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Int
</span><a href="../../base/src/Data.Foldable.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">[Grapheme]
</span><a href="#local-6989586621679094034"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Grapheme]
</span><a href="#local-6989586621679094026"><span class="hs-identifier hs-var">gs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-185"></span><span>                    </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Maybe InsertMode
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-186"></span><span>    </span><span id="local-6989586621679094025"><span class="annot"><span class="annottext">rxs :: [Grapheme]
</span><a href="#local-6989586621679094025"><span class="hs-identifier hs-var hs-var">rxs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Grapheme] -&gt; [Grapheme]
forall {a}. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="annot"><span class="annottext">[Grapheme]
</span><a href="#local-6989586621679094034"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-187"></span><span>
</span><span id="line-188"></span><span class="hs-comment">-- Search for the first entry in the history which satisfies the constraint.</span><span>
</span><span id="line-189"></span><span class="hs-comment">-- If it succeeds, the HistLog is updated and the result is returned.</span><span>
</span><span id="line-190"></span><span class="hs-comment">-- If it fails, the HistLog is unchanged.</span><span>
</span><span id="line-191"></span><span class="hs-comment">-- TODO: make the other history searching functions use this instead.</span><span>
</span><span id="line-192"></span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#findFirst"><span class="hs-identifier hs-type">findFirst</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-keyword">forall</span><span> </span><span id="local-6989586621679094408"><span class="annot"><a href="#local-6989586621679094408"><span class="hs-identifier hs-type">s</span></a></span></span><span> </span><span id="local-6989586621679094407"><span class="annot"><a href="#local-6989586621679094407"><span class="hs-identifier hs-type">m</span></a></span></span><span> </span><span class="hs-operator">.</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="System.Console.Haskeline.LineState.html#Save"><span class="hs-identifier hs-type">Save</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679094408"><span class="hs-identifier hs-type">s</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Monads.html#MonadState"><span class="hs-identifier hs-type">MonadState</span></a></span><span> </span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#HistLog"><span class="hs-identifier hs-type">HistLog</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679094407"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-193"></span><span>    </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="System.Console.Haskeline.LineState.html#Grapheme"><span class="hs-identifier hs-type">Grapheme</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679094408"><span class="hs-identifier hs-type">s</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#Direction"><span class="hs-identifier hs-type">Direction</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679094408"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679094407"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679094408"><span class="hs-identifier hs-type">s</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-194"></span><span id="findFirst"><span class="annot"><span class="annottext">findFirst :: forall s (m :: * -&gt; *).
(Save s, MonadState HistLog m) =&gt;
([Grapheme] -&gt; Maybe s) -&gt; Direction -&gt; s -&gt; m (Maybe s)
</span><a href="System.Console.Haskeline.Command.History.html#findFirst"><span class="hs-identifier hs-var hs-var">findFirst</span></a></span></span><span> </span><span id="local-6989586621679094008"><span class="annot"><span class="annottext">[Grapheme] -&gt; Maybe s
</span><a href="#local-6989586621679094008"><span class="hs-identifier hs-var">cond</span></a></span></span><span> </span><span class="annot"><span class="annottext">Direction
</span><a href="System.Console.Haskeline.Command.History.html#Forward"><span class="hs-identifier hs-var">Forward</span></a></span><span> </span><span id="local-6989586621679094007"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679094007"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">m (Maybe s) -&gt; m (Maybe s)
forall (m :: * -&gt; *) b. MonadState HistLog m =&gt; m b -&gt; m b
</span><a href="System.Console.Haskeline.Command.History.html#reverseHist"><span class="hs-identifier hs-var">reverseHist</span></a></span><span> </span><span class="annot"><span class="annottext">(m (Maybe s) -&gt; m (Maybe s)) -&gt; m (Maybe s) -&gt; m (Maybe s)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">([Grapheme] -&gt; Maybe s) -&gt; Direction -&gt; s -&gt; m (Maybe s)
forall s (m :: * -&gt; *).
(Save s, MonadState HistLog m) =&gt;
([Grapheme] -&gt; Maybe s) -&gt; Direction -&gt; s -&gt; m (Maybe s)
</span><a href="System.Console.Haskeline.Command.History.html#findFirst"><span class="hs-identifier hs-var">findFirst</span></a></span><span> </span><span class="annot"><span class="annottext">[Grapheme] -&gt; Maybe s
</span><a href="#local-6989586621679094008"><span class="hs-identifier hs-var">cond</span></a></span><span> </span><span class="annot"><span class="annottext">Direction
</span><a href="System.Console.Haskeline.Command.History.html#Reverse"><span class="hs-identifier hs-var">Reverse</span></a></span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679094007"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-195"></span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#findFirst"><span class="hs-identifier hs-var">findFirst</span></a></span><span> </span><span id="local-6989586621679094006"><span class="annot"><span class="annottext">[Grapheme] -&gt; Maybe s
</span><a href="#local-6989586621679094006"><span class="hs-identifier hs-var">cond</span></a></span></span><span> </span><span class="annot"><span class="annottext">Direction
</span><a href="System.Console.Haskeline.Command.History.html#Reverse"><span class="hs-identifier hs-var">Reverse</span></a></span><span> </span><span id="local-6989586621679094005"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679094005"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-196"></span><span>    </span><span id="local-6989586621679094004"><span class="annot"><span class="annottext">HistLog
</span><a href="#local-6989586621679094004"><span class="hs-identifier hs-var">hist</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">m HistLog
forall s (m :: * -&gt; *). MonadState s m =&gt; m s
</span><a href="System.Console.Haskeline.Monads.html#get"><span class="hs-identifier hs-var">get</span></a></span><span>
</span><span id="line-197"></span><span>    </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">[([Grapheme], HistLog)] -&gt; Maybe (s, HistLog)
</span><a href="#local-6989586621679094003"><span class="hs-identifier hs-var">search</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Grapheme] -&gt; HistLog -&gt; [([Grapheme], HistLog)]
</span><a href="System.Console.Haskeline.Command.History.html#prevHistories"><span class="hs-identifier hs-var">prevHistories</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">s -&gt; [Grapheme]
forall s. Save s =&gt; s -&gt; [Grapheme]
</span><a href="System.Console.Haskeline.LineState.html#listSave"><span class="hs-identifier hs-var">listSave</span></a></span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679094005"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">HistLog
</span><a href="#local-6989586621679094004"><span class="hs-identifier hs-var">hist</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-198"></span><span>        </span><span class="annot"><span class="annottext">Maybe (s, HistLog)
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Maybe s -&gt; m (Maybe s)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe s
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-199"></span><span>        </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679094002"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679094002"><span class="hs-identifier hs-var">s'</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679094001"><span class="annot"><span class="annottext">HistLog
</span><a href="#local-6989586621679094001"><span class="hs-identifier hs-var">hist'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">HistLog -&gt; m ()
forall s (m :: * -&gt; *). MonadState s m =&gt; s -&gt; m ()
</span><a href="System.Console.Haskeline.Monads.html#put"><span class="hs-identifier hs-var">put</span></a></span><span> </span><span class="annot"><span class="annottext">HistLog
</span><a href="#local-6989586621679094001"><span class="hs-identifier hs-var">hist'</span></a></span><span> </span><span class="annot"><span class="annottext">m () -&gt; m (Maybe s) -&gt; m (Maybe s)
forall (m :: * -&gt; *) a b. Monad m =&gt; m a -&gt; m b -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3E%3E"><span class="hs-operator hs-var">&gt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe s -&gt; m (Maybe s)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">s -&gt; Maybe s
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679094002"><span class="hs-identifier hs-var">s'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-200"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-201"></span><span>    </span><span class="annot"><a href="#local-6989586621679094003"><span class="hs-identifier hs-type">search</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="System.Console.Haskeline.LineState.html#Grapheme"><span class="hs-identifier hs-type">Grapheme</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#HistLog"><span class="hs-identifier hs-type">HistLog</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679094408"><span class="hs-identifier hs-type">s</span></a></span><span class="hs-special">,</span><span class="annot"><a href="System.Console.Haskeline.Command.History.html#HistLog"><span class="hs-identifier hs-type">HistLog</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-202"></span><span>    </span><span id="local-6989586621679094003"><span class="annot"><span class="annottext">search :: [([Grapheme], HistLog)] -&gt; Maybe (s, HistLog)
</span><a href="#local-6989586621679094003"><span class="hs-identifier hs-var hs-var">search</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (s, HistLog)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-203"></span><span>    </span><span class="annot"><a href="#local-6989586621679094003"><span class="hs-identifier hs-var">search</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span id="local-6989586621679094000"><span class="annot"><span class="annottext">[Grapheme]
</span><a href="#local-6989586621679094000"><span class="hs-identifier hs-var">g</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679093999"><span class="annot"><span class="annottext">HistLog
</span><a href="#local-6989586621679093999"><span class="hs-identifier hs-var">h</span></a></span></span><span class="hs-special">)</span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621679093998"><span class="annot"><span class="annottext">[([Grapheme], HistLog)]
</span><a href="#local-6989586621679093998"><span class="hs-identifier hs-var">gs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">[Grapheme] -&gt; Maybe s
</span><a href="#local-6989586621679094006"><span class="hs-identifier hs-var">cond</span></a></span><span> </span><span class="annot"><span class="annottext">[Grapheme]
</span><a href="#local-6989586621679094000"><span class="hs-identifier hs-var">g</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-204"></span><span>        </span><span class="annot"><span class="annottext">Maybe s
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[([Grapheme], HistLog)] -&gt; Maybe (s, HistLog)
</span><a href="#local-6989586621679094003"><span class="hs-identifier hs-var">search</span></a></span><span> </span><span class="annot"><span class="annottext">[([Grapheme], HistLog)]
</span><a href="#local-6989586621679093998"><span class="hs-identifier hs-var">gs</span></a></span><span>
</span><span id="line-205"></span><span>        </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621679093997"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679093997"><span class="hs-identifier hs-var">s'</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(s, HistLog) -&gt; Maybe (s, HistLog)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679093997"><span class="hs-identifier hs-var">s'</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">HistLog
</span><a href="#local-6989586621679093999"><span class="hs-identifier hs-var">h</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-206"></span><span>
</span><span id="line-207"></span></pre></body></html>